示例工程 02-values-and-types
02-values-and-types/03-coercion-table/_test.lua
-- @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.sum, 2)
h.eq(result.product, 20)
end)
h.it("相等比较不转换", function()
local result = m.run(function() end)
h.eq(result.eq, false)
end)
h.it("大小比较不转换", function()
local result = m.run(function() end)
h.eq(result.compare_ok, false)
h.truthy(result.compare_err:find("compare", 1, true), tostring(result.compare_err))
end)
end)
h.run()