Skip to content

Commit

Permalink
Devtest: Fix crash in player unittest (#9937)
Browse files Browse the repository at this point in the history
Happened if player unittests run when player has exactly 3 HP
  • Loading branch information
Wuzzy2 committed May 26, 2020
1 parent 083b285 commit 1afd6d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion games/devtest/mods/unittests/player.lua
Expand Up @@ -3,6 +3,9 @@
--
local expect = nil
local function run_hpchangereason_tests(player)
local old_hp = player:get_hp()

player:set_hp(20)
expect = { type = "set_hp", from = "mod" }
player:set_hp(3)
assert(expect == nil)
Expand All @@ -15,7 +18,7 @@ local function run_hpchangereason_tests(player)
player:set_hp(10, { type = "fall", df = 3458973454 })
assert(expect == nil)

player:set_hp(20)
player:set_hp(old_hp)
end

local function run_player_meta_tests(player)
Expand Down

0 comments on commit 1afd6d6

Please sign in to comment.