local d=require("\064\112\107\103\047\074\101\115\116\071\108\111\098\097\108\115")local h=d.test local c=d.expect local W=require("\046\047\099\114\101\097\116\101\084\097\098\108\101\080\097\115\115\116\104\114\111\117\103\104")h("\119\111\114\107\115 \102\111\114 \116\104\101 \117\115\101 \099\097\115\101 \111\102 \109\097\105\110\116\097\105\110\105\110\103 \103\108\111\098\097\108 \118\097\114\105\097\098\108\101\115",function()local d={}local h=W(d)local a=W(d)h.foo=true a.bar=true;(c(h.foo)).toBe(true);(c(h.bar)).toBe(true);(c(rawget(h,"\098\097\114"))).toBeUndefined();(c(a.bar)).toBe(true);(c(a.foo)).toBe(true);(c(rawget(a,"\102\111\111"))).toBeUndefined();(c(d.foo)).toBe(true);(c(d.bar)).toBe(true)end)
local JestGlobals = require("@pkg/JestGlobals")
local test = JestGlobals.test
local expect = JestGlobals.expect

local createTablePassthrough = require("./createTablePassthrough")

test("works for the use case of maintaining global variables", function()
	local allGlobals = {}
	local moduleGlobals1 = createTablePassthrough(allGlobals)
	local moduleGlobals2 = createTablePassthrough(allGlobals)

	moduleGlobals1.foo = true
	moduleGlobals2.bar = true

	expect(moduleGlobals1.foo).toBe(true)
	expect(moduleGlobals1.bar).toBe(true)
	expect(rawget(moduleGlobals1, "bar")).toBeUndefined()

	expect(moduleGlobals2.bar).toBe(true)
	expect(moduleGlobals2.foo).toBe(true)
	expect(rawget(moduleGlobals2, "foo")).toBeUndefined()

	expect(allGlobals.foo).toBe(true)
	expect(allGlobals.bar).toBe(true)
end)
