diff options
Diffstat (limited to 'games/devtest')
-rw-r--r-- | games/devtest/mods/unittests/itemdescription.lua | 11 |
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") |