示例工程 26-testing-and-lint

26-testing-and-lint/02-error-assertions/_test.lua

lua · 0.3 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.ok, false)
		h.truthy(r.message:find("not a number", 1, true) ~= nil)
	end)
end)
h.run()