From 35b73c6a488b3086583a91b714cc01af30a71ee2 Mon Sep 17 00:00:00 2001 From: Sid Shankar Date: Mon, 19 Aug 2024 20:41:04 +0000 Subject: [PATCH] Tests arbitrary module specifiers for TS --- .../test/library-tests/Modules/arbitrarySpecifier.ts | 5 +++++ .../ql/test/library-tests/Modules/tests.expected | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 javascript/ql/test/library-tests/Modules/arbitrarySpecifier.ts diff --git a/javascript/ql/test/library-tests/Modules/arbitrarySpecifier.ts b/javascript/ql/test/library-tests/Modules/arbitrarySpecifier.ts new file mode 100644 index 00000000000..64f88bd1bed --- /dev/null +++ b/javascript/ql/test/library-tests/Modules/arbitrarySpecifier.ts @@ -0,0 +1,5 @@ +import { "Foo::new" as Foo_new } from "./foo.wasm" + +const foo = Foo_new() + +export { Foo_new as "Foo::new" } \ No newline at end of file diff --git a/javascript/ql/test/library-tests/Modules/tests.expected b/javascript/ql/test/library-tests/Modules/tests.expected index a742e604218..fd7c1fb3620 100644 --- a/javascript/ql/test/library-tests/Modules/tests.expected +++ b/javascript/ql/test/library-tests/Modules/tests.expected @@ -4,6 +4,7 @@ test_ExportDeclarations | a.js:1:1:3:1 | export ... n 23;\\n} | | a.js:5:1:5:32 | export ... } = o; | | arbitarySpecifier.js:5:1:5:32 | export ... :new" } | +| arbitrarySpecifier.ts:5:1:5:32 | export ... :new" } | | b.js:5:1:5:18 | export { f as g }; | | b.js:7:1:7:21 | export ... './a'; | | d.js:4:1:4:20 | export * from 'm/c'; | @@ -20,6 +21,7 @@ test_ExportDefaultDeclarations | es2015_require.js:3:1:3:25 | export ... ss C {} | test_ExportSpecifiers | arbitarySpecifier.js:5:10:5:30 | Foo_new ... o::new" | arbitarySpecifier.js:5:10:5:16 | Foo_new | arbitarySpecifier.js:5:10:5:30 | Foo_new ... o::new" | +| arbitrarySpecifier.ts:5:10:5:30 | Foo_new ... o::new" | arbitrarySpecifier.ts:5:10:5:16 | Foo_new | arbitrarySpecifier.ts:5:21:5:30 | "Foo::new" | | b.js:5:10:5:15 | f as g | b.js:5:10:5:10 | f | b.js:5:15:5:15 | g | | e.js:2:10:2:10 | x | e.js:2:10:2:10 | x | e.js:2:10:2:10 | x | | e.js:2:13:2:13 | y | e.js:2:13:2:13 | y | e.js:2:13:2:13 | y | @@ -44,6 +46,7 @@ test_ImportNamespaceSpecifier | m/c.js:1:8:1:13 | * as b | test_ImportSpecifiers | arbitarySpecifier.js:1:10:1:30 | "Foo::n ... Foo_new | arbitarySpecifier.js:1:24:1:30 | Foo_new | +| arbitrarySpecifier.ts:1:10:1:30 | "Foo::n ... Foo_new | arbitrarySpecifier.ts:1:24:1:30 | Foo_new | | b.js:1:8:1:8 | f | b.js:1:8:1:8 | f | | d.js:1:10:1:21 | default as g | d.js:1:21:1:21 | g | | d.js:1:24:1:29 | x as y | d.js:1:29:1:29 | y | @@ -59,6 +62,7 @@ test_ImportSpecifiers | unresolved.js:1:8:1:8 | f | unresolved.js:1:8:1:8 | f | test_Imports | arbitarySpecifier.js:1:1:1:50 | import ... o.wasm" | arbitarySpecifier.js:1:39:1:50 | "./foo.wasm" | 1 | +| arbitrarySpecifier.ts:1:1:1:50 | import ... o.wasm" | arbitrarySpecifier.ts:1:39:1:50 | "./foo.wasm" | 1 | | b.js:1:1:1:20 | import f from './a'; | b.js:1:15:1:19 | './a' | 1 | | d.js:1:1:1:43 | import ... './a'; | d.js:1:38:1:42 | './a' | 2 | | d.js:2:1:2:13 | import './b'; | d.js:2:8:2:12 | './b' | 0 | @@ -77,6 +81,7 @@ test_Module_exports | a.js:1:1:5:32 | | x | a.js:5:18:5:20 | f() | | a.js:1:1:5:32 | | y | a.js:5:25:5:25 | y | | arbitarySpecifier.js:1:1:5:32 | | Foo::new | arbitarySpecifier.js:5:10:5:16 | Foo_new | +| arbitrarySpecifier.ts:1:1:5:32 | | Foo::new | arbitrarySpecifier.ts:5:10:5:16 | Foo_new | | b.js:1:1:8:0 | | f2 | a.js:1:16:3:1 | functio ... n 23;\\n} | | b.js:1:1:8:0 | | g | b.js:5:10:5:10 | f | | e.js:1:1:4:0 | | g | a.js:1:16:3:1 | functio ... n 23;\\n} | @@ -90,6 +95,7 @@ test_Module_exports | tst.html:4:23:8:0 | | y | tst.html:7:20:7:21 | 42 | test_NamedImportSpecifier | arbitarySpecifier.js:1:10:1:30 | "Foo::n ... Foo_new | +| arbitrarySpecifier.ts:1:10:1:30 | "Foo::n ... Foo_new | | d.js:1:10:1:21 | default as g | | d.js:1:24:1:29 | x as y | | g.ts:1:9:1:11 | foo | @@ -118,6 +124,7 @@ test_getAnImportedModule | library-tests/Modules/reExportNamespaceClient.js | library-tests/Modules/reExportNamespace.js | test_getExportedName | arbitarySpecifier.js:5:10:5:30 | Foo_new ... o::new" | Foo::new | +| arbitrarySpecifier.ts:5:10:5:30 | Foo_new ... o::new" | Foo::new | | b.js:5:10:5:15 | f as g | g | | b.js:7:8:7:9 | f2 | f2 | | e.js:2:10:2:10 | x | x | @@ -127,6 +134,7 @@ test_getExportedName | reExportNamespace.js:1:8:1:14 | * as ns | ns | test_getImportedName | arbitarySpecifier.js:1:10:1:30 | "Foo::n ... Foo_new | Foo::new | +| arbitrarySpecifier.ts:1:10:1:30 | "Foo::n ... Foo_new | Foo::new | | b.js:1:8:1:8 | f | default | | d.js:1:10:1:21 | default as g | default | | d.js:1:24:1:29 | x as y | x | @@ -140,6 +148,7 @@ test_getImportedName | unresolved.js:1:8:1:8 | f | default | test_getLocalName | arbitarySpecifier.js:5:10:5:30 | Foo_new ... o::new" | Foo_new | +| arbitrarySpecifier.ts:5:10:5:30 | Foo_new ... o::new" | Foo_new | | b.js:5:10:5:15 | f as g | f | | b.js:7:8:7:9 | f2 | default | | e.js:2:10:2:10 | x | x | @@ -151,6 +160,7 @@ test_getSourceNode | a.js:5:1:5:32 | export ... } = o; | x | a.js:5:18:5:20 | f() | | a.js:5:1:5:32 | export ... } = o; | y | a.js:5:25:5:25 | y | | arbitarySpecifier.js:5:1:5:32 | export ... :new" } | Foo::new | arbitarySpecifier.js:5:10:5:16 | Foo_new | +| arbitrarySpecifier.ts:5:1:5:32 | export ... :new" } | Foo::new | arbitrarySpecifier.ts:5:10:5:16 | Foo_new | | b.js:5:1:5:18 | export { f as g }; | g | b.js:5:10:5:10 | f | | b.js:7:1:7:21 | export ... './a'; | f2 | a.js:1:16:3:1 | functio ... n 23;\\n} | | e.js:2:1:2:16 | export { x, y }; | x | e.js:2:10:2:10 | x |