2024-05-21 16:27:38 +02:00
|
|
|
-- Test item (un)registration and overriding
|
|
|
|
do
|
|
|
|
local itemname = "unittests:test_override_item"
|
2024-10-28 15:57:54 +01:00
|
|
|
core.register_craftitem(":" .. itemname, {description = "foo"})
|
|
|
|
assert(assert(core.registered_items[itemname]).description == "foo")
|
|
|
|
core.override_item(itemname, {description = "bar"})
|
|
|
|
assert(assert(core.registered_items[itemname]).description == "bar")
|
|
|
|
core.override_item(itemname, {}, {"description"})
|
2024-05-21 16:27:38 +02:00
|
|
|
-- description has the empty string as a default
|
2024-10-28 15:57:54 +01:00
|
|
|
assert(assert(core.registered_items[itemname]).description == "")
|
|
|
|
core.unregister_item("unittests:test_override_item")
|
|
|
|
assert(core.registered_items["unittests:test_override_item"] == nil)
|
2024-05-21 16:27:38 +02:00
|
|
|
end
|