summaryrefslogtreecommitdiff
path: root/games/devtest/mods/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'games/devtest/mods/unittests')
-rw-r--r--games/devtest/mods/unittests/itemdescription.lua11
-rw-r--r--games/devtest/mods/unittests/mod.conf1
-rw-r--r--games/devtest/mods/unittests/textures/default_dirt.pngbin0 -> 790 bytes
3 files changed, 10 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")
diff --git a/games/devtest/mods/unittests/mod.conf b/games/devtest/mods/unittests/mod.conf
index 0d5e3c959..fa94e01a6 100644
--- a/games/devtest/mods/unittests/mod.conf
+++ b/games/devtest/mods/unittests/mod.conf
@@ -1,2 +1,3 @@
name = unittests
description = Adds automated unit tests for the engine
+depends = basenodes
diff --git a/games/devtest/mods/unittests/textures/default_dirt.png b/games/devtest/mods/unittests/textures/default_dirt.png
new file mode 100644
index 000000000..58670305d
--- /dev/null
+++ b/games/devtest/mods/unittests/textures/default_dirt.png
Binary files differ