Update import attributes tests to use the with keyword

This commit is contained in:
Nicolò Ribaudo 2023-09-13 13:51:31 +02:00 committed by Philip Chimento
parent e15f566216
commit 3ddb9e5e95
49 changed files with 161 additions and 175 deletions

View File

@ -8,7 +8,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions, async-functions] features: [dynamic-import, import-attributes, async-functions]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -8,7 +8,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions, async-functions] features: [dynamic-import, import-attributes, async-functions]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -12,7 +12,7 @@ info: |
a. Let optionsRef be the result of evaluating optionsExpression. a. Let optionsRef be the result of evaluating optionsExpression.
b. Let options be ? GetValue(optionsRef). b. Let options be ? GetValue(optionsRef).
[...] [...]
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
---*/ ---*/
var beforeCount = 0; var beforeCount = 0;

View File

@ -12,7 +12,7 @@ info: |
a. Let optionsRef be the result of evaluating optionsExpression. a. Let optionsRef be the result of evaluating optionsExpression.
b. Let options be ? GetValue(optionsRef). b. Let options be ? GetValue(optionsRef).
[...] [...]
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
---*/ ---*/
var beforeCount = 0; var beforeCount = 0;

View File

@ -12,7 +12,7 @@ info: |
a. Let optionsRef be the result of evaluating optionsExpression. a. Let optionsRef be the result of evaluating optionsExpression.
b. Let options be ? GetValue(optionsRef). b. Let options be ? GetValue(optionsRef).
[...] [...]
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
---*/ ---*/
var log = []; var log = [];

View File

@ -16,13 +16,13 @@ info: |
b. Let assertionsObj be Get(options, "assert"). b. Let assertionsObj be Get(options, "assert").
c. IfAbruptRejectPromise(assertionsObj, promiseCapability). c. IfAbruptRejectPromise(assertionsObj, promiseCapability).
[...] [...]
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/
var thrown = new Test262Error(); var thrown = new Test262Error();
var options = { var options = {
get assert() { get with() {
throw thrown; throw thrown;
} }
}; };

View File

@ -7,7 +7,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -16,7 +16,7 @@ info: |
i. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »). i. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
ii. Return promiseCapability.[[Promise]]. ii. Return promiseCapability.[[Promise]].
[...] [...]
features: [dynamic-import, import-assertions, Symbol, BigInt] features: [dynamic-import, import-attributes, Symbol, BigInt]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -9,7 +9,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -9,7 +9,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -21,13 +21,13 @@ info: |
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
iii. IfAbruptRejectPromise(keys, promiseCapability). iii. IfAbruptRejectPromise(keys, promiseCapability).
[...] [...]
features: [dynamic-import, import-assertions, Proxy] features: [dynamic-import, import-attributes, Proxy]
flags: [async] flags: [async]
---*/ ---*/
var thrown = new Test262Error(); var thrown = new Test262Error();
var options = { var options = {
assert: new Proxy({}, { with: new Proxy({}, {
ownKeys: function() { ownKeys: function() {
throw thrown; throw thrown;
}, },

View File

@ -22,7 +22,7 @@ info: |
[...] [...]
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
[...] [...]
features: [dynamic-import, import-assertions, json-modules, Symbol, Proxy] features: [dynamic-import, import-attributes, json-modules, Symbol, Proxy]
flags: [async] flags: [async]
---*/ ---*/
@ -36,7 +36,7 @@ var descriptors = {
var log = []; var log = [];
var options = { var options = {
assert: new Proxy({}, { with: new Proxy({}, {
ownKeys: function() { ownKeys: function() {
return ["type"]; return ["type"];
}, },

View File

@ -22,7 +22,7 @@ info: |
[...] [...]
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
[...] [...]
features: [dynamic-import, import-assertions, Symbol, Proxy] features: [dynamic-import, import-attributes, Symbol, Proxy]
flags: [async] flags: [async]
---*/ ---*/
@ -38,7 +38,7 @@ var descriptors = {
}; };
var options = { var options = {
assert: new Proxy({}, { with: new Proxy({}, {
ownKeys: function() { ownKeys: function() {
return [symbol, 'nonEnumerable', 'absent']; return [symbol, 'nonEnumerable', 'absent'];
}, },

View File

@ -23,7 +23,7 @@ info: |
newly created TypeError object »). newly created TypeError object »).
2. Return promiseCapability.[[Promise]]. 2. Return promiseCapability.[[Promise]].
[...] [...]
features: [dynamic-import, import-assertions, Symbol, BigInt] features: [dynamic-import, import-attributes, Symbol, BigInt]
flags: [async] flags: [async]
---*/ ---*/
@ -36,12 +36,12 @@ function test(promise, valueType) {
} }
Promise.all([ Promise.all([
test(import('./2nd-param_FIXTURE.js', {assert:null}), 'null'), test(import('./2nd-param_FIXTURE.js', {with:null}), 'null'),
test(import('./2nd-param_FIXTURE.js', {assert:false}), 'boolean'), test(import('./2nd-param_FIXTURE.js', {with:false}), 'boolean'),
test(import('./2nd-param_FIXTURE.js', {assert:23}), 'number'), test(import('./2nd-param_FIXTURE.js', {with:23}), 'number'),
test(import('./2nd-param_FIXTURE.js', {assert:''}), 'string'), test(import('./2nd-param_FIXTURE.js', {with:''}), 'string'),
test(import('./2nd-param_FIXTURE.js', {assert:Symbol('')}), 'symbol'), test(import('./2nd-param_FIXTURE.js', {with:Symbol('')}), 'symbol'),
test(import('./2nd-param_FIXTURE.js', {assert:23n}), 'bigint') test(import('./2nd-param_FIXTURE.js', {with:23n}), 'bigint')
]) ])
.then(function() {}) .then(function() {})
.then($DONE, $DONE); .then($DONE, $DONE);

View File

@ -21,13 +21,13 @@ info: |
newly created TypeError object »). newly created TypeError object »).
2. Return promiseCapability.[[Promise]]. 2. Return promiseCapability.[[Promise]].
[...] [...]
features: [dynamic-import, import-assertions, Symbol, BigInt] features: [dynamic-import, import-attributes, Symbol, BigInt]
flags: [async] flags: [async]
---*/ ---*/
Promise.all([ Promise.all([
import('./2nd-param_FIXTURE.js', {}), import('./2nd-param_FIXTURE.js', {}),
import('./2nd-param_FIXTURE.js', {assert:undefined}), import('./2nd-param_FIXTURE.js', {with:undefined}),
]) ])
.then(function(values) { .then(function(values) {
assert.sameValue(values[0].default, 262); assert.sameValue(values[0].default, 262);

View File

@ -19,13 +19,13 @@ info: |
1. Let value be Get(assertionsObj, key). 1. Let value be Get(assertionsObj, key).
2. IfAbruptRejectPromise(value, promiseCapability). 2. IfAbruptRejectPromise(value, promiseCapability).
[...] [...]
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/
var thrown = new Test262Error(); var thrown = new Test262Error();
import('./2nd-param_FIXTURE.js', {assert:{get ''() { throw thrown; }}}) import('./2nd-param_FIXTURE.js', {with:{get ''() { throw thrown; }}})
.then(function() { .then(function() {
throw new Test262Error('Expected promise to be rejected, but it was fulfilled'); throw new Test262Error('Expected promise to be rejected, but it was fulfilled');
}, function(error) { }, function(error) {

View File

@ -22,7 +22,7 @@ info: |
newly created TypeError object »). newly created TypeError object »).
b. Return promiseCapability.[[Promise]]. b. Return promiseCapability.[[Promise]].
[...] [...]
features: [dynamic-import, import-assertions, Symbol, BigInt] features: [dynamic-import, import-attributes, Symbol, BigInt]
flags: [async] flags: [async]
---*/ ---*/
@ -35,13 +35,13 @@ function test(promise, valueType) {
} }
Promise.all([ Promise.all([
test(import('./2nd-param_FIXTURE.js', {assert:{'': undefined}}), 'undefined'), test(import('./2nd-param_FIXTURE.js', {with:{'': undefined}}), 'undefined'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': null}}), 'null'), test(import('./2nd-param_FIXTURE.js', {with:{'': null}}), 'null'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': false}}), 'boolean'), test(import('./2nd-param_FIXTURE.js', {with:{'': false}}), 'boolean'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': 23}}), 'number'), test(import('./2nd-param_FIXTURE.js', {with:{'': 23}}), 'number'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': Symbol('')}}), 'symbol'), test(import('./2nd-param_FIXTURE.js', {with:{'': Symbol('')}}), 'symbol'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': 23n}}), 'bigint'), test(import('./2nd-param_FIXTURE.js', {with:{'': 23n}}), 'bigint'),
test(import('./2nd-param_FIXTURE.js', {assert:{'': {}}}), 'object') test(import('./2nd-param_FIXTURE.js', {with:{'': {}}}), 'object')
]) ])
.then(function() {}) .then(function() {})
.then($DONE, $DONE); .then($DONE, $DONE);

View File

@ -8,7 +8,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -8,7 +8,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [onlyStrict] flags: [onlyStrict]
negative: negative:
phase: parse phase: parse

View File

@ -8,7 +8,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async, noStrict] flags: [async, noStrict]
---*/ ---*/

View File

@ -9,7 +9,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -9,7 +9,7 @@ info: |
ImportCall[Yield, Await]: ImportCall[Yield, Await]:
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
features: [dynamic-import, import-assertions] features: [dynamic-import, import-attributes]
flags: [async] flags: [async]
---*/ ---*/

View File

@ -5,10 +5,10 @@ esid: sec-parse-json-module
description: Creates extensible arrays description: Creates extensible arrays
flags: [module] flags: [module]
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-array_FIXTURE.json' assert { type: 'json' }; import value from './json-value-array_FIXTURE.json' with { type: 'json' };
value.test262property = 'test262 value'; value.test262property = 'test262 value';

View File

@ -5,10 +5,10 @@ esid: sec-parse-json-module
description: Creates extensible objects description: Creates extensible objects
flags: [module] flags: [module]
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-object_FIXTURE.json' assert { type: 'json' }; import value from './json-value-object_FIXTURE.json' with { type: 'json' };
value.test262property = 'test262 value'; value.test262property = 'test262 value';

View File

@ -1,6 +1,6 @@
// 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.
import value from './json-idempotency_FIXTURE.json' assert { type: 'json' }; import value from './json-idempotency_FIXTURE.json' with { type: 'json' };
globalThis.viaSecondModule = value; globalThis.viaSecondModule = value;

View File

@ -4,17 +4,17 @@
esid: sec-parse-json-module esid: sec-parse-json-module
description: The same object representation is returned to all import sites description: The same object representation is returned to all import sites
flags: [module, async] flags: [module, async]
features: [import-assertions, json-modules, globalThis, dynamic-import] features: [import-attributes, json-modules, globalThis, dynamic-import]
---*/ ---*/
import viaStaticImport1 from './json-idempotency_FIXTURE.json' assert { type: 'json' }; import viaStaticImport1 from './json-idempotency_FIXTURE.json' with { type: 'json' };
import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' assert { type: 'json' }; import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' with { type: 'json' };
import './json-idempotency-indirect_FIXTURE.js'; import './json-idempotency-indirect_FIXTURE.js';
assert.sameValue(viaStaticImport1, viaStaticImport2); assert.sameValue(viaStaticImport1, viaStaticImport2);
assert.sameValue(globalThis.viaSecondModule, viaStaticImport1); assert.sameValue(globalThis.viaSecondModule, viaStaticImport1);
import('./json-idempotency_FIXTURE.json', { assert: { type: 'json' } }) import('./json-idempotency_FIXTURE.json', { with: { type: 'json' } })
.then(function(viaDynamicImport) { .then(function(viaDynamicImport) {
assert.sameValue(viaDynamicImport.default, viaStaticImport1); assert.sameValue(viaDynamicImport.default, viaStaticImport1);
}) })

View File

@ -12,7 +12,7 @@ info: |
1. Let json be ? Call(%JSON.parse%, undefined, « source »). 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
2. Return CreateDefaultExportSyntheticModule(json). 2. Return CreateDefaultExportSyntheticModule(json).
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
negative: negative:
phase: parse phase: parse
type: SyntaxError type: SyntaxError
@ -20,4 +20,4 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import value from './json-invalid_FIXTURE.json' assert { type: 'json' }; import value from './json-invalid_FIXTURE.json' with { type: 'json' };

View File

@ -9,7 +9,7 @@ info: |
This was ultimately rejected, so attempting to import in this way should This was ultimately rejected, so attempting to import in this way should
produce a SyntaxError. produce a SyntaxError.
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
negative: negative:
phase: parse phase: parse
type: SyntaxError type: SyntaxError
@ -17,4 +17,4 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import {name} from './json-named-bindings_FIXTURE.json' assert { type: 'json' }; import {name} from './json-named-bindings_FIXTURE.json' with { type: 'json' };

View File

@ -16,10 +16,10 @@ info: |
module record includes non-printable characters (specifically, all four forms module record includes non-printable characters (specifically, all four forms
of JSON's so-called "whitespace" token) both before and after the "value." of JSON's so-called "whitespace" token) both before and after the "value."
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-array_FIXTURE.json' assert { type: 'json' }; import value from './json-value-array_FIXTURE.json' with { type: 'json' };
assert(Array.isArray(value), 'the exported value is an array'); assert(Array.isArray(value), 'the exported value is an array');
assert.sameValue( assert.sameValue(

View File

@ -12,9 +12,9 @@ info: |
1. Let json be ? Call(%JSON.parse%, undefined, « source »). 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
2. Return CreateDefaultExportSyntheticModule(json). 2. Return CreateDefaultExportSyntheticModule(json).
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-boolean_FIXTURE.json' assert { type: 'json' }; import value from './json-value-boolean_FIXTURE.json' with { type: 'json' };
assert.sameValue(value, true); assert.sameValue(value, true);

View File

@ -12,9 +12,9 @@ info: |
1. Let json be ? Call(%JSON.parse%, undefined, « source »). 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
2. Return CreateDefaultExportSyntheticModule(json). 2. Return CreateDefaultExportSyntheticModule(json).
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-null_FIXTURE.json' assert { type: 'json' }; import value from './json-value-null_FIXTURE.json' with { type: 'json' };
assert.sameValue(value, null); assert.sameValue(value, null);

View File

@ -12,9 +12,9 @@ info: |
1. Let json be ? Call(%JSON.parse%, undefined, « source »). 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
2. Return CreateDefaultExportSyntheticModule(json). 2. Return CreateDefaultExportSyntheticModule(json).
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-number_FIXTURE.json' assert { type: 'json' }; import value from './json-value-number_FIXTURE.json' with { type: 'json' };
assert.sameValue(value, -1.2345); assert.sameValue(value, -1.2345);

View File

@ -17,10 +17,10 @@ info: |
of JSON's so-called "whitespace" token) both before and after the "value." of JSON's so-called "whitespace" token) both before and after the "value."
flags: [module] flags: [module]
includes: [propertyHelper.js] includes: [propertyHelper.js]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-object_FIXTURE.json' assert { type: 'json' }; import value from './json-value-object_FIXTURE.json' with { type: 'json' };
assert.sameValue(Object.getPrototypeOf(value), Object.prototype); assert.sameValue(Object.getPrototypeOf(value), Object.prototype);
assert.sameValue(Object.getOwnPropertyNames(value).length, 6); assert.sameValue(Object.getOwnPropertyNames(value).length, 6);

View File

@ -12,9 +12,9 @@ info: |
1. Let json be ? Call(%JSON.parse%, undefined, « source »). 1. Let json be ? Call(%JSON.parse%, undefined, « source »).
2. Return CreateDefaultExportSyntheticModule(json). 2. Return CreateDefaultExportSyntheticModule(json).
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import value from './json-value-string_FIXTURE.json' assert { type: 'json' }; import value from './json-value-string_FIXTURE.json' with { type: 'json' };
assert.sameValue(value, 'a string value'); assert.sameValue(value, 'a string value');

View File

@ -4,10 +4,10 @@
esid: sec-parse-json-module esid: sec-parse-json-module
description: May be imported via a module namespace object description: May be imported via a module namespace object
flags: [module] flags: [module]
features: [import-assertions, json-modules] features: [import-attributes, json-modules]
---*/ ---*/
import * as ns from './json-via-namespace_FIXTURE.json' assert { type: 'json' }; import * as ns from './json-via-namespace_FIXTURE.json' with { type: 'json' };
assert.sameValue(Object.getOwnPropertyNames(ns).length, 1); assert.sameValue(Object.getOwnPropertyNames(ns).length, 1);
assert.sameValue(ns.default, 262); assert.sameValue(ns.default, 262);

View File

@ -0,0 +1,33 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
`with` AttributesKeyword in WithClause in ImportDeclaration can
be preceded by a line terminator
esid: sec-modules
info: |
ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause:
AttributesKeyword {}
AttributesKeyword { WithEntries ,opt }
AttributesKeyword:
with
[no LineTerminator here] assert
negative:
phase: resolution
type: SyntaxError
features: [import-attributes, globalThis]
flags: [module, raw]
---*/
throw "Test262: This statement should not be evaluated.";
import "./ensure-linking-error_FIXTURE.js";
import * as x from './import-attribute-1_FIXTURE.js'
with
{ type: 'foo' };

View File

@ -8,7 +8,7 @@ info: |
- It is a Syntax Error if WithClauseToAttributes of WithClause 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-attributes]
flags: [module] flags: [module]
negative: negative:
phase: parse phase: parse
@ -17,7 +17,7 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
export * from './import-assertion-3_FIXTURE.js' assert { export * from './import-attribute-3_FIXTURE.js' with {
type: 'json', type: 'json',
'typ\u0065': '' 'typ\u0065': ''
}; };

View File

@ -9,7 +9,7 @@ info: |
- It is a Syntax Error if WithClauseToAttributes of WithClause 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-attributes]
flags: [module] flags: [module]
negative: negative:
phase: parse phase: parse
@ -18,7 +18,7 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import './import-assertion-2_FIXTURE.js' assert { import './import-attribute-2_FIXTURE.js' with {
type: 'json', type: 'json',
'typ\u0065': '' 'typ\u0065': ''
}; };

View File

@ -9,7 +9,7 @@ info: |
- It is a Syntax Error if WithClauseToAttributes of WithClause 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-attributes]
flags: [module] flags: [module]
negative: negative:
phase: parse phase: parse
@ -18,7 +18,7 @@ negative:
$DONOTEVALUATE(); $DONOTEVALUATE();
import x from './import-assertion-1_FIXTURE.js' assert { import x from './import-attribute-1_FIXTURE.js' with {
type: 'json', type: 'json',
'typ\u0065': '' 'typ\u0065': ''
}; };

View File

@ -1,47 +0,0 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
`assert` AttributesKeyword in WithClause in ImportDeclaration may not
be preceded by a line terminator
esid: sec-modules
info: |
ImportDeclaration:
import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause:
AttributesKeyword {}
AttributesKeyword { WithEntries ,opt }
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
the restriction more precisely.
features: [import-assertions, globalThis]
flags: [module, raw]
---*/
var callCount = 0;
// Define a property on the global "this" value so that the effect of the
// expected IdentifierReference can be observed.
Object.defineProperty(globalThis, 'assert', {
get: function() {
callCount += 1;
}
});
import * as x from './import-assertion-1_FIXTURE.js'
assert
{ type: 'json' };
if (x.default !== 262.1) {
throw 'module value incorrectly imported - first declaration';
}
if (callCount !== 1) {
throw 'IdentifierReference not recognized - first declaration';
}

View File

@ -8,8 +8,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -18,12 +18,12 @@ info: |
AttributeKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
import x from './import-assertion-1_FIXTURE.js' assert {}; import x from './import-attribute-1_FIXTURE.js' with {};
import './import-assertion-2_FIXTURE.js' assert {}; import './import-attribute-2_FIXTURE.js' with {};
export * from './import-assertion-3_FIXTURE.js' assert {}; export * from './import-attribute-3_FIXTURE.js' with {};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions] features: [import-attributes]
flags: [module] flags: [module]
---*/ ---*/
@ -30,8 +30,8 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {if:''}; import x from './import-attribute-1_FIXTURE.js' with {if:''};
import './import-assertion-2_FIXTURE.js' assert {if:''}; import './import-attribute-2_FIXTURE.js' with {if:''};
export * from './import-assertion-3_FIXTURE.js' assert {if:''}; export * from './import-attribute-3_FIXTURE.js' with {if:''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -30,8 +30,8 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''}; import x from './import-attribute-1_FIXTURE.js' with {"test262\u0078":''};
import './import-assertion-2_FIXTURE.js' assert {"test262\u0078":''}; import './import-attribute-2_FIXTURE.js' with {"test262\u0078":''};
export * from './import-assertion-3_FIXTURE.js' assert {"test262\u0078":''}; export * from './import-attribute-3_FIXTURE.js' with {"test262\u0078":''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -30,8 +30,8 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''}; import x from './import-attribute-1_FIXTURE.js' with {'test262\u0078':''};
import './import-assertion-2_FIXTURE.js' assert {'test262\u0078':''}; import './import-attribute-2_FIXTURE.js' with {'test262\u0078':''};
export * from './import-assertion-3_FIXTURE.js' assert {'test262\u0078':''}; export * from './import-attribute-3_FIXTURE.js' with {'test262\u0078':''};
assert.sameValue(x, 262.1); assert.sameValue(x, 262.1);

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -30,6 +30,6 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; 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-attribute-1_FIXTURE.js' with {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-attribute-2_FIXTURE.js' with {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-attribute-3_FIXTURE.js' with {test262_1:'',test262_2:'',test262_3:'',test262_4:''};

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -25,7 +25,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -33,7 +33,7 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert import x from './import-attribute-1_FIXTURE.js' with
{ {
@ -44,7 +44,7 @@ import x from './import-assertion-1_FIXTURE.js' assert
'' ''
}; };
import './import-assertion-2_FIXTURE.js' assert import './import-attribute-2_FIXTURE.js' with
{ {
@ -55,7 +55,7 @@ import './import-assertion-2_FIXTURE.js' assert
'' ''
}; };
export * from './import-assertion-3_FIXTURE.js' assert export * from './import-attribute-3_FIXTURE.js' with
{ {

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -30,6 +30,6 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:'',}; import x from './import-attribute-1_FIXTURE.js' with {test262:'',};
import './import-assertion-2_FIXTURE.js' assert {test262:'',}; import './import-attribute-2_FIXTURE.js' with {test262:'',};
export * from './import-assertion-3_FIXTURE.js' assert {test262:'',}; export * from './import-attribute-3_FIXTURE.js' with {test262:'',};

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -22,7 +22,7 @@ info: |
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
flags: [module] flags: [module]
---*/ ---*/
@ -30,6 +30,6 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"}; import x from './import-attribute-1_FIXTURE.js' with {test262:"\u0078"};
import './import-assertion-2_FIXTURE.js' assert {test262:"\u0078"}; import './import-attribute-2_FIXTURE.js' with {test262:"\u0078"};
export * from './import-assertion-3_FIXTURE.js' assert {test262:"\u0078"}; export * from './import-attribute-3_FIXTURE.js' with {test262:"\u0078"};

View File

@ -9,8 +9,8 @@ info: |
import ModuleSpecifier[no LineTerminator here] WithClause; import ModuleSpecifier[no LineTerminator here] WithClause;
WithClause: WithClause:
assert {} AttributesKeyword {}
assert {WithEntries ,opt} AttributesKeyword {WithEntries ,opt}
WithEntries: WithEntries:
AttributeKey : StringLiteral AttributeKey : StringLiteral
@ -19,7 +19,7 @@ info: |
AttributeKey: AttributeKey:
IdentifierName IdentifierName
StringLiteral StringLiteral
features: [import-assertions, globalThis] features: [import-attributes, globalThis]
negative: negative:
phase: resolution phase: resolution
type: SyntaxError type: SyntaxError
@ -30,6 +30,6 @@ $DONOTEVALUATE();
import "./ensure-linking-error_FIXTURE.js"; import "./ensure-linking-error_FIXTURE.js";
import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'}; import x from './import-attribute-1_FIXTURE.js' with {test262:'\u0078'};
import './import-assertion-2_FIXTURE.js' assert {test262:'\u0078'}; import './import-attribute-2_FIXTURE.js' with {test262:'\u0078'};
export * from './import-assertion-3_FIXTURE.js' assert {test262:'\u0078'}; export * from './import-attribute-3_FIXTURE.js' with {test262:'\u0078'};