Skip to content

Commit 2b77c79

Browse files
committed
JS: Add tests for 'export * as ns'
1 parent f5c805b commit 2b77c79

File tree

7 files changed

+19
-0
lines changed

7 files changed

+19
-0
lines changed

javascript/ql/test/library-tests/CallGraphs/AnnotatedTest/Test.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ spuriousCallee
22
missingCallee
33
| constructor-field.ts:40:5:40:14 | f3.build() | constructor-field.ts:13:3:13:12 | build() {} |
44
| constructor-field.ts:71:1:71:11 | bf3.build() | constructor-field.ts:13:3:13:12 | build() {} |
5+
| reExportLibClient.js:4:1:4:6 | ns.f() | lib.js:3:2:3:14 | function() {} |
56
badAnnotation
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: --experimental
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as ns from "./lib";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { ns } from "./reExportLib";
2+
3+
/** calls:lib.f */
4+
ns.f();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as ns from "./a";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ns } from "./reExportNamespace";
2+
3+
ns.x(); // Calls f() from a.js

javascript/ql/test/library-tests/Modules/tests.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test_ExportDeclarations
1212
| export-in-mjs.mjs:1:1:1:34 | export ... s = 42; |
1313
| f.ts:5:1:5:24 | export ... oo() {} |
1414
| m/c.js:5:1:5:30 | export ... '../b'; |
15+
| reExportNamespace.js:1:1:1:26 | export ... "./a"; |
1516
| tst.html:7:3:7:22 | export const y = 42; |
1617
test_ExportDefaultDeclarations
1718
| a.js:1:1:3:1 | export ... n 23;\\n} |
@@ -50,6 +51,7 @@ test_ImportSpecifiers
5051
| import-ts-with-js-extension.ts:1:10:1:12 | foo | import-ts-with-js-extension.ts:1:10:1:12 | foo |
5152
| importcss.js:1:8:1:8 | A | importcss.js:1:8:1:8 | A |
5253
| m/c.js:1:8:1:13 | * as b | m/c.js:1:13:1:13 | b |
54+
| reExportNamespaceClient.js:1:10:1:11 | ns | reExportNamespaceClient.js:1:10:1:11 | ns |
5355
| tst.html:5:10:5:10 | f | tst.html:5:10:5:10 | f |
5456
| unresolved.js:1:8:1:8 | f | unresolved.js:1:8:1:8 | f |
5557
test_Imports
@@ -63,6 +65,7 @@ test_Imports
6365
| import-ts-with-js-extension.ts:1:1:1:29 | import ... /f.js"; | import-ts-with-js-extension.ts:1:21:1:28 | "./f.js" | 1 |
6466
| importcss.js:1:1:1:24 | import ... a.css"; | importcss.js:1:15:1:23 | "./a.css" | 1 |
6567
| m/c.js:1:1:1:26 | import ... '../b'; | m/c.js:1:20:1:25 | '../b' | 1 |
68+
| reExportNamespaceClient.js:1:1:1:41 | import ... space"; | reExportNamespaceClient.js:1:20:1:40 | "./reEx ... espace" | 1 |
6669
| tst.html:5:3:5:20 | import f from 'a'; | tst.html:5:17:5:19 | 'a' | 1 |
6770
| unresolved.js:1:1:1:18 | import f from 'a'; | unresolved.js:1:15:1:17 | 'a' | 1 |
6871
test_Module_exports
@@ -84,13 +87,15 @@ test_NamedImportSpecifier
8487
| d.js:1:24:1:29 | x as y |
8588
| g.ts:1:9:1:11 | foo |
8689
| import-ts-with-js-extension.ts:1:10:1:12 | foo |
90+
| reExportNamespaceClient.js:1:10:1:11 | ns |
8791
test_OtherImports
8892
| es2015_require.js:1:11:1:24 | require('./d') | d.js:1:1:5:0 | <toplevel> |
8993
test_ReExportDeclarations
9094
| b.js:7:1:7:21 | export ... './a'; | b.js:7:16:7:20 | './a' |
9195
| d.js:4:1:4:20 | export * from 'm/c'; | d.js:4:15:4:19 | 'm/c' |
9296
| e.js:3:1:3:35 | export ... './a'; | e.js:3:30:3:34 | './a' |
9397
| m/c.js:5:1:5:30 | export ... '../b'; | m/c.js:5:24:5:29 | '../b' |
98+
| reExportNamespace.js:1:1:1:26 | export ... "./a"; | reExportNamespace.js:1:21:1:25 | "./a" |
9499
test_getAnImportedModule
95100
| library-tests/Modules/b.js | library-tests/Modules/a.js |
96101
| library-tests/Modules/d.js | library-tests/Modules/a.js |
@@ -100,13 +105,15 @@ test_getAnImportedModule
100105
| library-tests/Modules/g.ts | library-tests/Modules/f.ts |
101106
| library-tests/Modules/import-ts-with-js-extension.ts | library-tests/Modules/f.ts |
102107
| library-tests/Modules/m/c.js | library-tests/Modules/b.js |
108+
| library-tests/Modules/reExportNamespaceClient.js | library-tests/Modules/reExportNamespace.js |
103109
test_getExportedName
104110
| b.js:5:10:5:15 | f as g | g |
105111
| b.js:7:8:7:9 | f2 | f2 |
106112
| e.js:2:10:2:10 | x | x |
107113
| e.js:2:13:2:13 | y | y |
108114
| e.js:3:10:3:21 | default as g | g |
109115
| m/c.js:5:10:5:15 | g as h | h |
116+
| reExportNamespace.js:1:8:1:14 | * as ns | ns |
110117
test_getImportedName
111118
| b.js:1:8:1:8 | f | default |
112119
| d.js:1:10:1:21 | default as g | default |
@@ -116,6 +123,7 @@ test_getImportedName
116123
| import-in-mjs.mjs:1:8:1:24 | exported_from_mjs | default |
117124
| import-ts-with-js-extension.ts:1:10:1:12 | foo | foo |
118125
| importcss.js:1:8:1:8 | A | default |
126+
| reExportNamespaceClient.js:1:10:1:11 | ns | ns |
119127
| tst.html:5:10:5:10 | f | default |
120128
| unresolved.js:1:8:1:8 | f | default |
121129
test_getLocalName

0 commit comments

Comments
 (0)