示例工程 07-functions-and-tail-calls

07-functions-and-tail-calls/01-multret-expansion/_test.lua

lua · 0.4 KB

-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
h.describe("多重返回", function()
	h.it("末尾展开,非末尾截断", function()
		local r = m.run(function() end)
		h.eq(r.a, 1)
		h.eq(r.b, 2)
		h.eq(r.c, 1)
		h.eq(r.d, 0)
	end)
	h.it("table.pack 保留数量", function()
		local r = m.run(function() end)
		h.eq(r.packed, 2)
	end)
end)
h.run()