mirror of
https://github.com/littensy/charm.git
synced 2026-10-23 05:46:27 +00:00
22 lines
603 B
Lua
22 lines
603 B
Lua
local atom = require(script.Parent.Parent.atom)
|
|
local capture = require(script.Parent.Parent.capture)
|
|
|
|
return function()
|
|
it("captures atoms from a function", function()
|
|
local a, b, c = atom(1), atom(1), atom(2)
|
|
local captured, result = capture(function()
|
|
return a() + b()
|
|
end)
|
|
expect(captured[a]).to.be.ok()
|
|
expect(captured[b]).to.be.ok()
|
|
expect(captured[c]).to.never.be.ok()
|
|
expect(result).to.equal(2)
|
|
end)
|
|
|
|
it("captures an atom by itself", function()
|
|
local a = atom(1)
|
|
local captured, result = capture(a)
|
|
expect(captured[a]).to.be.ok()
|
|
expect(result).to.equal(1)
|
|
end)
|
|
end
|