-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for
export * as ns from 'foo'
syntax (#1498)
- Loading branch information
1 parent
358e5e8
commit 2fa8fc4
Showing
36 changed files
with
369 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-module-semantics-static-semantics-early-errors | ||
description: > | ||
It is a Syntax Error if the ExportedNames of ModuleItemList contains any | ||
duplicate entries. | ||
flags: [module, export-star-as-namespace-from-module] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ | ||
|
||
throw "Test262: This statement should not be evaluated."; | ||
|
||
var x; | ||
export { x as z }; | ||
export * as z from "early-dup-export-as-star-as.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/language/module-code/early-dup-export-star-as-dflt.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-module-semantics-static-semantics-early-errors | ||
description: > | ||
It is a Syntax Error if the ExportedNames of ModuleItemList contains any | ||
duplicate entries. | ||
flags: [module, export-star-as-namespace-from-module] | ||
negative: | ||
phase: parse | ||
type: SyntaxError | ||
---*/ | ||
|
||
throw "Test262: This statement should not be evaluated."; | ||
|
||
var x; | ||
export default x; | ||
export * as default from 'early-dup-export-start-as-dflt.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
Function('return this;')().test262 += '9'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
test/language/module-code/instn-star-as-props-dflt-skip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
Default exports are not included in an imported module namespace object when module exported with `* as namespace` | ||
esid: sec-moduledeclarationinstantiation | ||
info: | | ||
[...] | ||
4. Let result be InnerModuleInstantiation(module, stack, 0). | ||
[...] | ||
InnerModuleInstantiation( module, stack, index ) | ||
[...] | ||
10. Perform ? ModuleDeclarationEnvironmentSetup(module). | ||
[...] | ||
ModuleDeclarationEnvironmentSetup( module ) | ||
[...] | ||
c. If in.[[ImportName]] is "*", then | ||
[...] | ||
d. Else, | ||
i. Let resolution be ? importedModule.ResolveExport(in.[[ImportName]], « »). | ||
ii. If resolution is null or "ambiguous", throw a SyntaxError exception. | ||
iii. If resolution.[[BindingName]] is "*namespace*", then | ||
1. Let namespace be ? GetModuleNamespace(resolution.[[Module]]). | ||
[...] | ||
15.2.1.18 Runtime Semantics: GetModuleNamespace | ||
[...] | ||
3. If namespace is undefined, then | ||
a. Let exportedNames be ? module.GetExportedNames(« »). | ||
[...] | ||
15.2.1.16.2 GetExportedNames | ||
[...] | ||
7. For each ExportEntry Record e in module.[[StarExportEntries]], do | ||
[...] | ||
c. For each element n of starNames, do | ||
i. If SameValue(n, "default") is false, then | ||
[...] | ||
flags: [module, export-star-as-namespace-from-module] | ||
---*/ | ||
|
||
import named from './instn-star-props-dflt-skip-star-as-named_FIXTURE.js'; | ||
import production from './instn-star-props-dflt-skip-star-as-prod_FIXTURE.js'; | ||
|
||
assert('namedOther' in named); | ||
assert.sameValue( | ||
'default' in named, false, 'default specified via identifier' | ||
); | ||
|
||
assert('productionOther' in production); | ||
assert.sameValue( | ||
'default' in production, false, 'default specified via dedicated production' | ||
); |
6 changes: 6 additions & 0 deletions
6
test/language/module-code/instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
var x; | ||
export var namedOther = null; | ||
export { x as default }; |
4 changes: 4 additions & 0 deletions
4
test/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export * as named from './instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js'; |
5 changes: 5 additions & 0 deletions
5
test/language/module-code/instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export var productionOther = null; | ||
export default null; |
4 changes: 4 additions & 0 deletions
4
test/language/module-code/instn-star-props-dflt-skip-star-as-prod_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export * as production from './instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...guage/module-code/namespace/internals/get-nested-namespace-dflt-skip-named-end_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
var x; | ||
export var namedOther = null; | ||
export { x as default }; |
4 changes: 4 additions & 0 deletions
4
.../language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export * as namedns2 from './get-nested-namespace-dflt-skip-named-end_FIXTURE.js'; |
5 changes: 5 additions & 0 deletions
5
...nguage/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export var productionOther = null; | ||
export default null; |
4 changes: 4 additions & 0 deletions
4
test/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export * as productionns2 from './get-nested-namespace-dflt-skip-prod-end_FIXTURE.js'; |
42 changes: 42 additions & 0 deletions
42
test/language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
Default exports are not included in an imported module namespace object when a namespace object is created. | ||
esid: sec-module-namespace-exotic-objects-get-p-receiver | ||
info: | | ||
[...] | ||
6. Let binding be ! m.ResolveExport(P, « »). | ||
7. Assert: binding is a ResolvedBinding Record. | ||
8. Let targetModule be binding.[[Module]]. | ||
9. Assert: targetModule is not undefined. | ||
10. If binding.[[BindingName]] is "*namespace*", then | ||
11. Return ? GetModuleNamespace(targetModule). | ||
Runtime Semantics: GetModuleNamespace | ||
[...] | ||
3. If namespace is undefined, then | ||
a. Let exportedNames be ? module.GetExportedNames(« »). | ||
b. Let unambiguousNames be a new empty List. | ||
c. For each name that is an element of exportedNames, | ||
i. Let resolution be ? module.ResolveExport(name, « », « »). | ||
ii. If resolution is null, throw a SyntaxError exception. | ||
iii. If resolution is not "ambiguous", append name to | ||
unambiguousNames. | ||
d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). | ||
[...] | ||
flags: [module, export-star-as-namespace-from-module] | ||
---*/ | ||
|
||
import * as namedns1 from './get-nested-namespace-dflt-skip-named_FIXTURE.js'; | ||
import * as productionns1 from './get-nested-namespace-dflt-skip-prod_FIXTURE.js'; | ||
|
||
assert('namedOther' in namedns1.namedns2); | ||
assert.sameValue( | ||
'default' in namedns1.namedns2, false, 'default specified via identifier' | ||
); | ||
|
||
assert('productionOther' in productionns1.productionns2); | ||
assert.sameValue( | ||
'default' in productionns1.productionns2, false, 'default specified via dedicated production' | ||
); |
4 changes: 4 additions & 0 deletions
4
test/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (C) 2018 Valerie Young. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
export * as exportns from './get-nested-namespace-props-nrml-2_FIXTURE.js'; |
Oops, something went wrong.