aboutsummaryrefslogtreecommitdiff
path: root/games/devtest
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-05-26 15:45:34 +0200
committersfan5 <sfan5@live.de>2022-05-29 14:00:19 +0200
commit8908a9101608d3343023b470743ef63f1c44b0b7 (patch)
tree026ce924286a08222bbb88936e203fce7f116f68 /games/devtest
parent261a8db9dd0403f8d0a7d71f46d4cb272e217cd1 (diff)
downloadminetest-8908a9101608d3343023b470743ef63f1c44b0b7.tar.gz
minetest-8908a9101608d3343023b470743ef63f1c44b0b7.tar.bz2
minetest-8908a9101608d3343023b470743ef63f1c44b0b7.zip
Get rid of node metadata when it becomes empty
fixes #8943
Diffstat (limited to 'games/devtest')
-rw-r--r--games/devtest/mods/unittests/misc.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/games/devtest/mods/unittests/misc.lua b/games/devtest/mods/unittests/misc.lua
index ba980866a..4b53004b1 100644
--- a/games/devtest/mods/unittests/misc.lua
+++ b/games/devtest/mods/unittests/misc.lua
@@ -48,3 +48,23 @@ local function test_v3s16_metatable(player, pos)
assert(vector.check(found_pos))
end
unittests.register("test_v3s16_metatable", test_v3s16_metatable, {map=true})
+
+local function test_clear_meta(_, pos)
+ local ref = core.get_meta(pos)
+
+ for way = 1, 3 do
+ ref:set_string("foo", "bar")
+ assert(ref:contains("foo"))
+
+ if way == 1 then
+ ref:from_table({})
+ elseif way == 2 then
+ ref:from_table(nil)
+ else
+ ref:set_string("foo", "")
+ end
+
+ assert(#core.find_nodes_with_meta(pos, pos) == 0, "clearing failed " .. way)
+ end
+end
+unittests.register("test_clear_meta", test_clear_meta, {map=true})