2022-05-02 20:55:04 +02:00
|
|
|
unittests = {}
|
|
|
|
|
|
|
|
core.log("info", "Hello World")
|
|
|
|
|
2022-07-04 01:06:42 +02:00
|
|
|
local function do_tests()
|
2022-05-02 20:55:04 +02:00
|
|
|
assert(core == minetest)
|
|
|
|
-- stuff that should not be here
|
|
|
|
assert(not core.get_player_by_name)
|
|
|
|
assert(not core.set_node)
|
|
|
|
assert(not core.object_refs)
|
|
|
|
-- stuff that should be here
|
|
|
|
assert(ItemStack)
|
2023-06-17 19:52:40 +02:00
|
|
|
local meta = ItemStack():get_meta()
|
|
|
|
assert(type(meta) == "userdata")
|
|
|
|
assert(type(meta.set_tool_capabilities) == "function")
|
2022-05-02 20:55:04 +02:00
|
|
|
assert(core.registered_items[""])
|
2023-08-14 15:07:16 +02:00
|
|
|
assert(next(core.registered_nodes) ~= nil)
|
|
|
|
assert(core.registered_craftitems["unittests:stick"])
|
2022-07-04 01:06:42 +02:00
|
|
|
-- alias handling
|
|
|
|
assert(core.registered_items["unittests:steel_ingot_alias"].name ==
|
|
|
|
"unittests:steel_ingot")
|
|
|
|
end
|
|
|
|
|
|
|
|
function unittests.async_test()
|
|
|
|
local ok, err = pcall(do_tests)
|
|
|
|
if not ok then
|
|
|
|
core.log("error", err)
|
|
|
|
end
|
|
|
|
return ok
|
2022-05-02 20:55:04 +02:00
|
|
|
end
|