示例工程 01-mental-model

01-mental-model/02-luac-bytecode/_test.lua

lua · 0.4 KB

-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
 
h.describe("编译与字节码", function()
	h.it("同一函数可重复执行", function()
		local result = m.run(function() end)
		h.eq(result.first, 3)
		h.eq(result.second, 3)
	end)
 
	h.it("dump 产出非空字节码", function()
		local result = m.run(function() end)
		h.truthy(result.bytes > 0, tostring(result.bytes))
	end)
end)
 
h.run()