summaryrefslogtreecommitdiff
path: root/games/devtest/mods/unittests/inside_async_env.lua
blob: 4ed0fccd23aa8b685b3a36347eb87da4ba61c7d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
unittests = {}

core.log("info", "Hello World")

local function do_tests()
	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)
	assert(core.registered_items[""])
	-- 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
end