mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Fix short_description fallback order (#10943)
This commit is contained in:
parent
7832b6843e
commit
a8f6befd39
4 changed files with 20 additions and 14 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue