示例工程 01-mental-model
01-mental-model/01-hello-chunk/_test.lua
-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
h.describe("最小 chunk", function()
h.it("返回运行时版本与消息", function()
local lines = {}
local result = m.run(function(text)
lines[#lines + 1] = text
end)
h.eq(result.message, "hello from chunk")
h.eq(lines, { "hello from chunk" })
h.truthy(result.version:find("Lua", 1, true), result.version)
end)
end)
h.run()