aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/unittests
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2021-02-17 18:53:44 +0000
committerGitHub <noreply@github.com>2021-02-17 18:53:44 +0000
commita8f6befd398cb8f962f3bb1fab092d6355bfe015 (patch)
tree57c8410f8491b94692963f68cf43be3d100d7c90 /games/devtest/mods/unittests
parent7832b6843e73410e15677d1324d582b4b7c7e824 (diff)
downloadminetest-a8f6befd398cb8f962f3bb1fab092d6355bfe015.tar.gz
minetest-a8f6befd398cb8f962f3bb1fab092d6355bfe015.tar.bz2
minetest-a8f6befd398cb8f962f3bb1fab092d6355bfe015.zip
Fix short_description fallback order (#10943)
Diffstat (limited to 'games/devtest/mods/unittests')
-rw-r--r--games/devtest/mods/unittests/itemdescription.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/games/devtest/mods/unittests/itemdescription.lua b/games/devtest/mods/unittests/itemdescription.lua
index 1d0826545..d6ee6551a 100644
--- a/games/devtest/mods/unittests/itemdescription.lua
+++ b/games/devtest/mods/unittests/itemdescription.lua
@@ -26,15 +26,22 @@ minetest.register_chatcommand("item_description", {
})
function unittests.test_short_desc()
+ local function get_short_description(item)
+ return ItemStack(item):get_short_description()
+ end
+
local stack = ItemStack("unittests:colorful_pick")
assert(stack:get_short_description() == "Colorful Pickaxe")
- assert(stack:get_short_description() == minetest.registered_items["unittests:colorful_pick"].short_description)
+ assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe")
+ assert(minetest.registered_items["unittests:colorful_pick"].short_description == nil)
assert(stack:get_description() == full_description)
assert(stack:get_description() == minetest.registered_items["unittests:colorful_pick"].description)
stack:get_meta():set_string("description", "Hello World")
- assert(stack:get_short_description() == "Colorful Pickaxe")
+ assert(stack:get_short_description() == "Hello World")
assert(stack:get_description() == "Hello World")
+ assert(get_short_description(stack) == "Hello World")
+ assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe")
stack:get_meta():set_string("short_description", "Foo Bar")
assert(stack:get_short_description() == "Foo Bar")