Skip to content

Commit

Permalink
Add a (pending) test to document ephemeron behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Feb 14, 2024
1 parent 6a4e506 commit 0108797
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/resources/spec/table_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ describe("Lua tables", function()
local k, v = next(t)
expect(v):eq("t1")
end)

it("behaves like an ephemeron table :lua>=5.2 :!cobalt", function()
local t = setmode({}, "k")

local t1 = {}
t[t1] = { t1 }
t1 = nil

collectgarbage()

local k, v = next(t)
expect(k):eq(nil)
end)
end)

describe("with weak values", function()
Expand Down

0 comments on commit 0108797

Please sign in to comment.