load_time.lua 651 B

12345678910111213
  1. -- Test item (un)registration and overriding
  2. do
  3. local itemname = "unittests:test_override_item"
  4. core.register_craftitem(":" .. itemname, {description = "foo"})
  5. assert(assert(core.registered_items[itemname]).description == "foo")
  6. core.override_item(itemname, {description = "bar"})
  7. assert(assert(core.registered_items[itemname]).description == "bar")
  8. core.override_item(itemname, {}, {"description"})
  9. -- description has the empty string as a default
  10. assert(assert(core.registered_items[itemname]).description == "")
  11. core.unregister_item("unittests:test_override_item")
  12. assert(core.registered_items["unittests:test_override_item"] == nil)
  13. end