From 1bb53aee3efab63cdd775c5db0b70ce01a44f2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 13 Sep 2023 11:35:06 +0200 Subject: [PATCH] Update import attributes `assert` tests to current semantics (#3919) Co-authored-by: Jordan Harband --- .../2nd-param-assert-enumeration-abrupt.js | 2 +- ...2nd-param-assert-enumeration-enumerable.js | 60 ++++++++++++++++ .../2nd-param-assert-enumeration.js | 18 ++--- .../import-assertions/2nd-param_FIXTURE.json | 1 + .../early-dup-assert-key-export.js | 11 ++- .../early-dup-assert-key-import-nobinding.js | 11 ++- ...early-dup-assert-key-import-withbinding.js | 11 ++- .../ensure-linking-error_FIXTURE.js | 9 +++ .../eval-gtbndng-indirect-faux-assertion.js | 47 ++++--------- .../import-assertion-2_FIXTURE.js | 2 +- .../import-assertion-empty.js | 16 ++--- .../import-assertion-key-identifiername.js | 24 ++++--- .../import-assertion-key-string-double.js | 24 ++++--- .../import-assertion-key-string-single.js | 24 ++++--- .../import-assertion-many.js | 26 ++++--- .../import-assertion-newlines.js | 68 ++++++++++++------- .../import-assertion-trlng-comma.js | 26 ++++--- .../import-assertion-value-string-double.js | 26 ++++--- .../import-assertion-value-string-single.js | 26 ++++--- 19 files changed, 261 insertions(+), 171 deletions(-) create mode 100644 test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js create mode 100644 test/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json create mode 100644 test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js diff --git a/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js index a181764e899..282c7613aac 100644 --- a/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js +++ b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js @@ -1,7 +1,7 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // 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 info: | 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) diff --git a/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js new file mode 100644 index 00000000000..151bb1738db --- /dev/null +++ b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js @@ -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']); diff --git a/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js index ae31dcc0180..cfa9d28a8f1 100644 --- a/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js +++ b/test/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js @@ -3,7 +3,7 @@ /*--- description: > Follows the semantics of the EnumerableOwnPropertyNames abstract operation - during assertion enumeration + during attributes enumeration esid: sec-import-call-runtime-semantics-evaluation info: | 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) @@ -28,28 +28,22 @@ flags: [async] var symbol = Symbol(''); var target = { - enumerable1: '', - enumerable2: '', [symbol]: '', unreported: '', nonEnumerable: '' }; var descriptors = { - enumerable1: {configurable: true, enumerable: true}, - enumerable2: {configurable: true, enumerable: true}, [symbol]: {configurable: true, enumerable: true}, nonEnumerable: {configurable: true, enumerable: false} }; -var log = []; var options = { assert: new Proxy({}, { ownKeys: function() { - return ['enumerable1', symbol, 'nonEnumerable', 'absent', 'enumerable2']; + return [symbol, 'nonEnumerable', 'absent']; }, - get(_, name) { - log.push(name); - return target[name]; + get() { + throw new Error("Should not be called"); }, getOwnPropertyDescriptor(target, name) { return descriptors[name]; @@ -62,7 +56,3 @@ import('./2nd-param_FIXTURE.js', options) assert.sameValue(module.default, 262); }) .then($DONE, $DONE); - -assert.sameValue(log.length, 2); -assert.sameValue(log[0], 'enumerable1'); -assert.sameValue(log[1], 'enumerable2'); diff --git a/test/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json b/test/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json new file mode 100644 index 00000000000..5484d82917f --- /dev/null +++ b/test/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json @@ -0,0 +1 @@ +262 diff --git a/test/language/module-code/import-assertions/early-dup-assert-key-export.js b/test/language/module-code/import-assertions/early-dup-assert-key-export.js index f7ab23233ea..9f44e359a04 100644 --- a/test/language/module-code/import-assertions/early-dup-assert-key-export.js +++ b/test/language/module-code/import-assertions/early-dup-assert-key-export.js @@ -1,12 +1,12 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // 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 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]]. features: [import-assertions] flags: [module] @@ -18,7 +18,6 @@ negative: $DONOTEVALUATE(); export * from './import-assertion-3_FIXTURE.js' assert { - test262_a: '', - test262_b: '', - 'test262_\u0061': '' + type: 'json', + 'typ\u0065': '' }; diff --git a/test/language/module-code/import-assertions/early-dup-assert-key-import-nobinding.js b/test/language/module-code/import-assertions/early-dup-assert-key-import-nobinding.js index 7c8e6e3c39e..7c486996304 100644 --- a/test/language/module-code/import-assertions/early-dup-assert-key-import-nobinding.js +++ b/test/language/module-code/import-assertions/early-dup-assert-key-import-nobinding.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - AssertClause may not have duplicate keys (import declaration without binding) + WithClause may not have duplicate keys (import declaration without binding) esid: sec-modules 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]]. features: [import-assertions] flags: [module] @@ -19,7 +19,6 @@ negative: $DONOTEVALUATE(); import './import-assertion-2_FIXTURE.js' assert { - test262_a: '', - test262_b: '', - 'test262_\u0061': '' + type: 'json', + 'typ\u0065': '' }; diff --git a/test/language/module-code/import-assertions/early-dup-assert-key-import-withbinding.js b/test/language/module-code/import-assertions/early-dup-assert-key-import-withbinding.js index 57b66d59a44..08744558828 100644 --- a/test/language/module-code/import-assertions/early-dup-assert-key-import-withbinding.js +++ b/test/language/module-code/import-assertions/early-dup-assert-key-import-withbinding.js @@ -2,12 +2,12 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - AssertClause may not have duplicate keys (import declaration with binding) + WithClause may not have duplicate keys (import declaration with binding) esid: sec-modules 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]]. features: [import-assertions] flags: [module] @@ -19,7 +19,6 @@ negative: $DONOTEVALUATE(); import x from './import-assertion-1_FIXTURE.js' assert { - test262_a: '', - test262_b: '', - 'test262_\u0061': '' + type: 'json', + 'typ\u0065': '' }; diff --git a/test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js b/test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js new file mode 100644 index 00000000000..7ef1588e3e1 --- /dev/null +++ b/test/language/module-code/import-assertions/ensure-linking-error_FIXTURE.js @@ -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"; diff --git a/test/language/module-code/import-assertions/eval-gtbndng-indirect-faux-assertion.js b/test/language/module-code/import-assertions/eval-gtbndng-indirect-faux-assertion.js index 09f6f3d6067..46b60695105 100644 --- a/test/language/module-code/import-assertions/eval-gtbndng-indirect-faux-assertion.js +++ b/test/language/module-code/import-assertions/eval-gtbndng-indirect-faux-assertion.js @@ -2,23 +2,20 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: - assert {} - assert {AssertEntries ,opt} + WithClause: + AttributesKeyword {} + AttributesKeyword { WithEntries ,opt } - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries - - AssertionKey: - IdentifierName - StringLiteral + AttributesKeyword: + with + [no LineTerminator here] assert The restriction LineTerminator could be verified more simply with a negative 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 -{test262:''}; +{ type: 'json' }; -if (x !== 262.1) { +if (x.default !== 262.1) { throw 'module value incorrectly imported - first declaration'; } if (callCount !== 1) { 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'; -} diff --git a/test/language/module-code/import-assertions/import-assertion-2_FIXTURE.js b/test/language/module-code/import-assertions/import-assertion-2_FIXTURE.js index c05aa68d2e8..a717e7ac573 100644 --- a/test/language/module-code/import-assertions/import-assertion-2_FIXTURE.js +++ b/test/language/module-code/import-assertions/import-assertion-2_FIXTURE.js @@ -1,3 +1,3 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -globalThis.test262 = 262.2; +export default 262.2; diff --git a/test/language/module-code/import-assertions/import-assertion-empty.js b/test/language/module-code/import-assertions/import-assertion-empty.js index 0df9911c522..c01c3b77852 100644 --- a/test/language/module-code/import-assertions/import-assertion-empty.js +++ b/test/language/module-code/import-assertions/import-assertion-empty.js @@ -1,21 +1,21 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral features: [import-assertions, globalThis] diff --git a/test/language/module-code/import-assertions/import-assertion-key-identifiername.js b/test/language/module-code/import-assertions/import-assertion-key-identifiername.js index dbb1d48f62f..605b49f7399 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-identifiername.js +++ b/test/language/module-code/import-assertions/import-assertion-key-identifiername.js @@ -2,30 +2,36 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {if:''}; import './import-assertion-2_FIXTURE.js' assert {if:''}; export * from './import-assertion-3_FIXTURE.js' assert {if:''}; assert.sameValue(x, 262.1); -assert.sameValue(globalThis.test262, 262.2); diff --git a/test/language/module-code/import-assertions/import-assertion-key-string-double.js b/test/language/module-code/import-assertions/import-assertion-key-string-double.js index 663ef220c30..0a6491686a2 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-string-double.js +++ b/test/language/module-code/import-assertions/import-assertion-key-string-double.js @@ -2,30 +2,36 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''}; import './import-assertion-2_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); diff --git a/test/language/module-code/import-assertions/import-assertion-key-string-single.js b/test/language/module-code/import-assertions/import-assertion-key-string-single.js index 4b04c708779..edccfeb08e2 100644 --- a/test/language/module-code/import-assertions/import-assertion-key-string-single.js +++ b/test/language/module-code/import-assertions/import-assertion-key-string-single.js @@ -2,30 +2,36 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''}; import './import-assertion-2_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); diff --git a/test/language/module-code/import-assertions/import-assertion-many.js b/test/language/module-code/import-assertions/import-assertion-many.js index 6f0a405740c..fccf8be5c22 100644 --- a/test/language/module-code/import-assertions/import-assertion-many.js +++ b/test/language/module-code/import-assertions/import-assertion-many.js @@ -2,30 +2,34 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - AssertClause in ImportDeclaration may contain multiple AssertEntries + WithClause in ImportDeclaration may contain multiple WithEntries esid: sec-modules info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] 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 './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:''}; - -assert.sameValue(x, 262.1); -assert.sameValue(globalThis.test262, 262.2); diff --git a/test/language/module-code/import-assertions/import-assertion-newlines.js b/test/language/module-code/import-assertions/import-assertion-newlines.js index 80d42c736ce..10cfba52a4a 100644 --- a/test/language/module-code/import-assertions/import-assertion-newlines.js +++ b/test/language/module-code/import-assertions/import-assertion-newlines.js @@ -2,48 +2,70 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - AssertClause in ImportDeclaration may include line terminators + WithClause in ImportDeclaration may include line terminators esid: sec-modules info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral This test uses all four LineFeed characters in order to completely verify the grammar. +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert - 

{ - 

test262 - 

: - 

'' - 

}; + +

{ + +

test262 + +

: + +

'' + +

}; import './import-assertion-2_FIXTURE.js' assert - 

{ - 

test262 - 

: - 

'' - 

}; + +

{ + +

test262 + +

: + +

'' + +

}; export * from './import-assertion-3_FIXTURE.js' assert - 

{ - 

test262 - 

: - 

'' - 

}; + +

{ + +

test262 + +

: + +

'' + +

}; assert.sameValue(x, 262.1); assert.sameValue(globalThis.test262, 262.2); diff --git a/test/language/module-code/import-assertions/import-assertion-trlng-comma.js b/test/language/module-code/import-assertions/import-assertion-trlng-comma.js index 1daceef77d7..323c61fac4f 100644 --- a/test/language/module-code/import-assertions/import-assertion-trlng-comma.js +++ b/test/language/module-code/import-assertions/import-assertion-trlng-comma.js @@ -2,30 +2,34 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- description: > - AssertClause in ImportDeclaration may contain a trailing comma + WithClause in ImportDeclaration may contain a trailing comma esid: sec-modules info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {test262:'',}; import './import-assertion-2_FIXTURE.js' assert {test262:'',}; export * from './import-assertion-3_FIXTURE.js' assert {test262:'',}; - -assert.sameValue(x, 262.1); -assert.sameValue(globalThis.test262, 262.2); diff --git a/test/language/module-code/import-assertions/import-assertion-value-string-double.js b/test/language/module-code/import-assertions/import-assertion-value-string-double.js index 59c810deabd..fc24b2e269d 100644 --- a/test/language/module-code/import-assertions/import-assertion-value-string-double.js +++ b/test/language/module-code/import-assertions/import-assertion-value-string-double.js @@ -2,30 +2,34 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral +negative: + phase: resolution + type: SyntaxError features: [import-assertions, globalThis] flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"}; import './import-assertion-2_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); diff --git a/test/language/module-code/import-assertions/import-assertion-value-string-single.js b/test/language/module-code/import-assertions/import-assertion-value-string-single.js index a6d473863ce..0e0ef844bfa 100644 --- a/test/language/module-code/import-assertions/import-assertion-value-string-single.js +++ b/test/language/module-code/import-assertions/import-assertion-value-string-single.js @@ -2,30 +2,34 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- 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 info: | ImportDeclaration: - import ModuleSpecifier[no LineTerminator here] AssertClause; + import ModuleSpecifier[no LineTerminator here] WithClause; - AssertClause: + WithClause: assert {} - assert {AssertEntries ,opt} + assert {WithEntries ,opt} - AssertEntries: - AssertionKey : StringLiteral - AssertionKey : StringLiteral , AssertEntries + WithEntries: + AttributeKey : StringLiteral + AttributeKey : StringLiteral , WithEntries - AssertionKey: + AttributeKey: IdentifierName StringLiteral features: [import-assertions, globalThis] +negative: + phase: resolution + type: SyntaxError flags: [module] ---*/ +$DONOTEVALUATE(); + +import "./ensure-linking-error_FIXTURE.js"; + import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'}; import './import-assertion-2_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);