summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/04_modules/04_export_rename
blob: 49057fd638d6d2f889c700f1801dc74a1c88cdd4 (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
By using the `as` keyword, exports may be renamed when using the export
list syntax. It is also possible to specify string aliases which are not
valid variable names, in this case a rename on import is mandatory.

-- File test.uc --
let testvar = 123;
const testconst = "Test";

function testfunc() {
	print("Hello, world!\n");
}

export { testvar as modvar, testconst as 'define', testfunc as "module-function" };
-- End --

-- Testcase --
import { modvar, define, "module-function" as func } from "./files/test.uc";

print([ modvar, define, func ], "\n");
-- End --

-- Args --
-R
-- End --

-- Expect stdout --
[ 123, "Test", "function testfunc() { ... }" ]
-- End --