示例工程 05-variables-and-scope
05-variables-and-scope/03-multi-assign-truncation/_test.lua
-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
h.describe("多重赋值", function()
h.it("右侧不足补 nil", function()
local result = m.run(function() end)
h.eq(result.a, 1)
h.eq(result.b, 2)
h.eq(result.c, nil)
end)
h.it("只有最后一个位置展开多重返回", function()
local result = m.run(function() end)
h.eq(result.m, 1)
h.eq(result.n, 2)
h.eq(result.p, 1)
h.eq(result.q, 10)
end)
end)
h.run()