示例工程 13-closures-and-upvalues
13-closures-and-upvalues/02-loop-capture/_test.lua
-- @runtimes lua54 luajit
local h = require("harness")
local m = require("main")
h.describe("循环捕获", function()
h.it("local 在循环内才独立", function()
local r = m.run(function() end)
h.eq(r.shared, { 1, 2, 3 })
h.eq(r.fresh, { 3, 3, 3 })
end)
end)
h.run()