Update import attributes assert tests to current semantics (#3919)

Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
Nicolò Ribaudo 2023-09-13 11:35:06 +02:00 committed by GitHub
parent e98bfb332e
commit 1bb53aee3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 261 additions and 171 deletions

View File

@ -1,7 +1,7 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved. // Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: Reports abrupt completions produced by assertion enumeration description: Reports abrupt completions produced by attributes enumeration
esid: sec-import-call-runtime-semantics-evaluation esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )

View File

@ -0,0 +1,60 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Follows the semantics of the EnumerableOwnPropertyNames abstract operation
during attributes enumeration
esid: sec-import-call-runtime-semantics-evaluation
info: |
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
[...]
6. Let promiseCapability be ! NewPromiseCapability(%Promise%).
7. Let specifierString be ToString(specifier).
8. IfAbruptRejectPromise(specifierString, promiseCapability).
9. Let assertions be a new empty List.
10. If options is not undefined, then
a. If Type(options) is not Object,
[...]
b. Let assertionsObj be Get(options, "assert").
c. IfAbruptRejectPromise(assertionsObj, promiseCapability).
d. If assertionsObj is not undefined,
i. If Type(assertionsObj) is not Object,
[...]
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
[...]
features: [dynamic-import, import-assertions, json-modules, Symbol, Proxy]
includes: [compareArray.js]
flags: [async]
---*/
var symbol = Symbol('');
var target = {
type: "json"
};
var descriptors = {
type: {configurable: true, enumerable: true}
};
var log = [];
var options = {
assert: new Proxy({}, {
ownKeys: function() {
return ["type"];
},
get(_, name) {
log.push(name);
return "json";
},
getOwnPropertyDescriptor(target, name) {
return {configurable: true, enumerable: true, value: "json"};
},
})
};
import('./2nd-param_FIXTURE.json', options)
.then(function(module) {
assert.sameValue(module.default, 262);
})
.then($DONE, $DONE);
assert.compareArray(log, ['type']);

View File

@ -3,7 +3,7 @@
/*--- /*---
description: > description: >
Follows the semantics of the EnumerableOwnPropertyNames abstract operation Follows the semantics of the EnumerableOwnPropertyNames abstract operation
during assertion enumeration during attributes enumeration
esid: sec-import-call-runtime-semantics-evaluation esid: sec-import-call-runtime-semantics-evaluation
info: | info: |
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
@ -28,28 +28,22 @@ flags: [async]
var symbol = Symbol(''); var symbol = Symbol('');
var target = { var target = {
enumerable1: '',
enumerable2: '',
[symbol]: '', [symbol]: '',
unreported: '', unreported: '',
nonEnumerable: '' nonEnumerable: ''
}; };
var descriptors = { var descriptors = {
enumerable1: {configurable: true, enumerable: true},
enumerable2: {configurable: true, enumerable: true},
[symbol]: {configurable: true, enumerable: true}, [symbol]: {configurable: true, enumerable: true},
nonEnumerable: {configurable: true, enumerable: false} nonEnumerable: {configurable: true, enumerable: false}
}; };
var log = [];
var options = { var options = {
assert: new Proxy({}, { assert: new Proxy({}, {
ownKeys: function() { ownKeys: function() {
return ['enumerable1', symbol, 'nonEnumerable', 'absent', 'enumerable2']; return [symbol, 'nonEnumerable', 'absent'];
}, },
get(_, name) { get() {
log.push(name); throw new Error("Should not be called");
return target[name];
}, },
getOwnPropertyDescriptor(target, name) { getOwnPropertyDescriptor(target, name) {
return descriptors[name]; return descriptors[name];
@ -62,7 +56,3 @@ import('./2nd-param_FIXTURE.js', options)
assert.sameValue(module.default, 262); assert.sameValue(module.default, 262);
}) })
.then($DONE, $DONE); .then($DONE, $DONE);
assert.sameValue(log.length, 2);
assert.sameValue(log[0], 'enumerable1');
assert.sameValue(log[1], 'enumerable2');

View File

@ -1,12 +1,12 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved. // Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: AssertClause may not have duplicate keys (export declaration) description: WithClause may not have duplicate keys (export declaration)
esid: sec-modules esid: sec-modules
info: | info: |
AssertClause:assert{AssertEntries,opt} WithClause: AttributesKeyword { WithEntries,opt }
- It is a Syntax Error if AssertClauseToAssertions of AssertClause has two - It is a Syntax Error if WithClauseToAttributes of WithClause has two
entries a and b such that a.[[Key]] is b.[[Key]]. entries a and b such that a.[[Key]] is b.[[Key]].
features: [import-assertions] features: [import-assertions]
flags: [module] flags: [module]
@ -18,7 +18,6 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
export * from './import-assertion-3_FIXTURE.js' assert { export * from './import-assertion-3_FIXTURE.js' assert {
test262_a: '', type: 'json',
test262_b: '', 'typ\u0065': ''
'test262_\u0061': ''
}; };

View File

@ -2,12 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause may not have duplicate keys (import declaration without binding) WithClause may not have duplicate keys (import declaration without binding)
esid: sec-modules esid: sec-modules
info: | info: |
AssertClause:assert{AssertEntries,opt} WithClause: AttributesKeyword { WithEntries,opt }
- It is a Syntax Error if AssertClauseToAssertions of AssertClause has two - It is a Syntax Error if WithClauseToAttributes of WithClause has two
entries a and b such that a.[[Key]] is b.[[Key]]. entries a and b such that a.[[Key]] is b.[[Key]].
features: [import-assertions] features: [import-assertions]
flags: [module] flags: [module]
@ -19,7 +19,6 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import './import-assertion-2_FIXTURE.js' assert { import './import-assertion-2_FIXTURE.js' assert {
test262_a: '', type: 'json',
test262_b: '', 'typ\u0065': ''
'test262_\u0061': ''
}; };

View File

@ -2,12 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause may not have duplicate keys (import declaration with binding) WithClause may not have duplicate keys (import declaration with binding)
esid: sec-modules esid: sec-modules
info: | info: |
AssertClause:assert{AssertEntries,opt} WithClause: AttributesKeyword { WithEntries,opt }
- It is a Syntax Error if AssertClauseToAssertions of AssertClause has two - It is a Syntax Error if WithClauseToAttributes of WithClause has two
entries a and b such that a.[[Key]] is b.[[Key]]. entries a and b such that a.[[Key]] is b.[[Key]].
features: [import-assertions] features: [import-assertions]
flags: [module] flags: [module]
@ -19,7 +19,6 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import x from './import-assertion-1_FIXTURE.js' assert { import x from './import-assertion-1_FIXTURE.js' assert {
test262_a: '', type: 'json',
test262_b: '', 'typ\u0065': ''
'test262_\u0061': ''
}; };

View File

@ -0,0 +1,9 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
// When imported, this file will ensure that a linking error happens by
// importing a non-existent binding.
// It can be used to assert that there is a linking error, which means
// that there are no parsing errors.
import { nonExistent } from "./import-assertion-ensure-resolution-error_FIXTURE.js";

View File

@ -2,23 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may not be preceded by a line terminator `assert` AttributesKeyword in WithClause in ImportDeclaration may not
be preceded by a line terminator
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} AttributesKeyword {}
assert {AssertEntries ,opt} AttributesKeyword { WithEntries ,opt }
AssertEntries: AttributesKeyword:
AssertionKey : StringLiteral with
AssertionKey : StringLiteral , AssertEntries [no LineTerminator here] assert
AssertionKey:
IdentifierName
StringLiteral
The restriction LineTerminator could be verified more simply with a negative The restriction LineTerminator could be verified more simply with a negative
syntax test. This test is designed to parse successfully in order to verify syntax test. This test is designed to parse successfully in order to verify
@ -37,34 +34,14 @@ Object.defineProperty(globalThis, 'assert', {
} }
}); });
import x from './import-assertion-1_FIXTURE.js' import * as x from './import-assertion-1_FIXTURE.js'
assert assert
{test262:''}; { type: 'json' };
if (x !== 262.1) { if (x.default !== 262.1) {
throw 'module value incorrectly imported - first declaration'; throw 'module value incorrectly imported - first declaration';
} }
if (callCount !== 1) { if (callCount !== 1) {
throw 'IdentifierReference not recognized - first declaration'; throw 'IdentifierReference not recognized - first declaration';
} }
import './import-assertion-2_FIXTURE.js'
assert
{test262:''};
if (globalThis.test262 !== 262.2) {
throw 'module value incorrectly imported - second declaration';
}
if (callCount !== 2) {
throw 'IdentifierReference not recognized - second declaration';
}
export * from './import-assertion-3_FIXTURE.js'
assert
{test262:''};
if (callCount !== 3) {
throw 'IdentifierReference not recognized - third declaration';
}

View File

@ -1,3 +1,3 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved. // Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
globalThis.test262 = 262.2; export default 262.2;

View File

@ -1,21 +1,21 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved. // Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: AssertClause in ImportDeclaration may be empty description: WithClause in ImportDeclaration may be empty
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
features: [import-assertions, globalThis] features: [import-assertions, globalThis]

View File

@ -2,30 +2,36 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may use any valid IdentifierName as a key WithClause in ImportDeclaration may use any valid IdentifierName as a key
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions] features: [import-assertions]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {if:''}; import x from './import-assertion-1_FIXTURE.js' assert {if:''};
import './import-assertion-2_FIXTURE.js' assert {if:''}; import './import-assertion-2_FIXTURE.js' assert {if:''};
export * from './import-assertion-3_FIXTURE.js' assert {if:''}; export * from './import-assertion-3_FIXTURE.js' assert {if:''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,36 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may use a string literal as a key (delimited with U+0022) WithClause in ImportDeclaration may use a string literal as a key (delimited with U+0022)
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''}; import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''};
import './import-assertion-2_FIXTURE.js' assert {"test262\u0078":''}; import './import-assertion-2_FIXTURE.js' assert {"test262\u0078":''};
export * from './import-assertion-3_FIXTURE.js' assert {"test262\u0078":''}; export * from './import-assertion-3_FIXTURE.js' assert {"test262\u0078":''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,36 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may use a string literal as a key (delimited with U+0027) WithClause in ImportDeclaration may use a string literal as a key (delimited with U+0027)
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''}; import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''};
import './import-assertion-2_FIXTURE.js' assert {'test262\u0078':''}; import './import-assertion-2_FIXTURE.js' assert {'test262\u0078':''};
export * from './import-assertion-3_FIXTURE.js' assert {'test262\u0078':''}; export * from './import-assertion-3_FIXTURE.js' assert {'test262\u0078':''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,34 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may contain multiple AssertEntries WithClause in ImportDeclaration may contain multiple WithEntries
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; import x from './import-assertion-1_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
import './import-assertion-2_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; import './import-assertion-2_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
export * from './import-assertion-3_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''}; export * from './import-assertion-3_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,48 +2,70 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may include line terminators WithClause in ImportDeclaration may include line terminators
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
This test uses all four LineFeed characters in order to completely verify the This test uses all four LineFeed characters in order to completely verify the
grammar. grammar.
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert import x from './import-assertion-1_FIXTURE.js' assert
{
test262 {
:
'' test262
};
:
''
};
import './import-assertion-2_FIXTURE.js' assert import './import-assertion-2_FIXTURE.js' assert
{
test262 {
:
'' test262
};
:
''
};
export * from './import-assertion-3_FIXTURE.js' assert export * from './import-assertion-3_FIXTURE.js' assert
{
test262 {
:
'' test262
};
:
''
};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2); assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,34 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may contain a trailing comma WithClause in ImportDeclaration may contain a trailing comma
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:'',}; import x from './import-assertion-1_FIXTURE.js' assert {test262:'',};
import './import-assertion-2_FIXTURE.js' assert {test262:'',}; import './import-assertion-2_FIXTURE.js' assert {test262:'',};
export * from './import-assertion-3_FIXTURE.js' assert {test262:'',}; export * from './import-assertion-3_FIXTURE.js' assert {test262:'',};
assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,34 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may use a string literal as a value (delimited with U+0022) WithClause in ImportDeclaration may use a string literal as a value (delimited with U+0022)
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
negative:
phase: resolution
type: SyntaxError
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"}; import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"};
import './import-assertion-2_FIXTURE.js' assert {test262:"\u0078"}; import './import-assertion-2_FIXTURE.js' assert {test262:"\u0078"};
export * from './import-assertion-3_FIXTURE.js' assert {test262:"\u0078"}; export * from './import-assertion-3_FIXTURE.js' assert {test262:"\u0078"};
assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);

View File

@ -2,30 +2,34 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
AssertClause in ImportDeclaration may use a string literal as a value (delimited with U+0027) WithClause in ImportDeclaration may use a string literal as a value (delimited with U+0027)
esid: sec-modules esid: sec-modules
info: | info: |
ImportDeclaration: ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] AssertClause; import ModuleSpecifier[no LineTerminator here] WithClause;
AssertClause: WithClause:
assert {} assert {}
assert {AssertEntries ,opt} assert {WithEntries ,opt}
AssertEntries: WithEntries:
AssertionKey : StringLiteral AttributeKey : StringLiteral
AssertionKey : StringLiteral , AssertEntries AttributeKey : StringLiteral , WithEntries
AssertionKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
features: [import-assertions, globalThis] features: [import-assertions, globalThis]
negative:
phase: resolution
type: SyntaxError
flags: [module] flags: [module]
---*/ ---*/
$DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'}; import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'};
import './import-assertion-2_FIXTURE.js' assert {test262:'\u0078'}; import './import-assertion-2_FIXTURE.js' assert {test262:'\u0078'};
export * from './import-assertion-3_FIXTURE.js' assert {test262:'\u0078'}; export * from './import-assertion-3_FIXTURE.js' assert {test262:'\u0078'};
assert.sameValue(x, 262.1);
assert.sameValue(globalThis.test262, 262.2);