blob: d9a4edd4926ddec36e8a77a00698d9b9042eb534 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import("core.package.package")
function main()
local foo1 = package.load_from_project("foo")
local foo2 = package.load_from_project("foo")
assert(foo1 and foo2, "load_from_project(foo) failed!")
assert(table.contains(table.wrap(foo1:get("defines")), "FOO_BASE"), "foo1 missing FOO_BASE")
assert(table.contains(table.wrap(foo2:get("defines")), "FOO_BASE"), "foo2 missing FOO_BASE")
-- mutating one instance should not leak into the other
foo1:add("defines", "FOO_LEAK")
assert(table.contains(table.wrap(foo1:get("defines")), "FOO_LEAK"), "foo1 missing FOO_LEAK")
assert(not table.contains(table.wrap(foo2:get("defines")), "FOO_LEAK"), "FOO_LEAK leaked into foo2")
foo1:set("foo_leak", false)
assert(foo1:get("foo_leak") == false, "foo1 foo_leak not set")
assert(foo2:get("foo_leak") ~= false, "foo_leak leaked into foo2")
end
|