Devtest: Fix crash in player unittest (#9937)
Happened if player unittests run when player has exactly 3 HPmaster
parent
083b285f43
commit
1afd6d682a
|
@ -3,6 +3,9 @@
|
||||||
--
|
--
|
||||||
local expect = nil
|
local expect = nil
|
||||||
local function run_hpchangereason_tests(player)
|
local function run_hpchangereason_tests(player)
|
||||||
|
local old_hp = player:get_hp()
|
||||||
|
|
||||||
|
player:set_hp(20)
|
||||||
expect = { type = "set_hp", from = "mod" }
|
expect = { type = "set_hp", from = "mod" }
|
||||||
player:set_hp(3)
|
player:set_hp(3)
|
||||||
assert(expect == nil)
|
assert(expect == nil)
|
||||||
|
@ -15,7 +18,7 @@ local function run_hpchangereason_tests(player)
|
||||||
player:set_hp(10, { type = "fall", df = 3458973454 })
|
player:set_hp(10, { type = "fall", df = 3458973454 })
|
||||||
assert(expect == nil)
|
assert(expect == nil)
|
||||||
|
|
||||||
player:set_hp(20)
|
player:set_hp(old_hp)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function run_player_meta_tests(player)
|
local function run_player_meta_tests(player)
|
||||||
|
|
Loading…
Reference in New Issue