示例工程 06-control-flow-and-truthiness

06-control-flow-and-truthiness/04-and-or-false-trap/_test.lua

lua · 0.4 KB

-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
 
h.describe("and/or false 陷阱", function()
	h.it("b 为 false 时错误地取 c", function()
		local result = m.run(function() end)
		h.eq(result.trap, "fallback")
	end)
 
	h.it("包装成表可保留 false", function()
		local result = m.run(function() end)
		h.eq(result.fixed, false)
	end)
end)
 
h.run()