summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-05-26 19:49:02 +0200
committerGitHub <noreply@github.com>2020-05-26 19:49:02 +0200
commit1afd6d682af3c9c1d568ba7ea2dc0b5b998090aa (patch)
treef6cbe66393daf5a3740c7c62d5b6622ee332e3ff /games
parent083b285f4319c470f307f0b52f03a2fb68facd38 (diff)
downloadminetest-1afd6d682af3c9c1d568ba7ea2dc0b5b998090aa.tar.gz
minetest-1afd6d682af3c9c1d568ba7ea2dc0b5b998090aa.tar.bz2
minetest-1afd6d682af3c9c1d568ba7ea2dc0b5b998090aa.zip
Devtest: Fix crash in player unittest (#9937)
Happened if player unittests run when player has exactly 3 HP
Diffstat (limited to 'games')
-rw-r--r--games/devtest/mods/unittests/player.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/games/devtest/mods/unittests/player.lua b/games/devtest/mods/unittests/player.lua
index 10781a95f..4a681310d 100644
--- a/games/devtest/mods/unittests/player.lua
+++ b/games/devtest/mods/unittests/player.lua
@@ -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)
@@ -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)