summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/04_modules/11_import_many_exec_once
blob: f469c7fed3155e9cb040d46b09858badbde3d280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
When multiple imports refer to the same module, the module will only be
executed once. The equivalence of module paths is tested after canonicalizing
the requested path.

-- Testcase --
import { counter as counter1 } from "./files/test/example.uc";
import { counter as counter2 } from "files/test/example.uc";
import { counter as counter3 } from "test.example";

print([ counter1, counter2, counter3 ], "\n");
-- End --

-- File test/example.uc --
print("This is the test module running\n");

export let counter = 0;

counter++;
-- End --

-- Args --
-R -L ./files
-- End --

-- Expect stdout --
This is the test module running
[ 1, 1, 1 ]
-- End --