mirror of https://github.com/tc39/test262.git
Remove import-assertions test files
This commit is contained in:
parent
2e1843d0a5
commit
cfd81e1698
|
@ -1,14 +0,0 @@
|
|||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
desc: ImportCall trailing comma following first parameter
|
||||
template: syntax/valid
|
||||
info: |
|
||||
ImportCall :
|
||||
import( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [import-assertions]
|
||||
---*/
|
||||
|
||||
//- import
|
||||
import('./empty_FIXTURE.js',)
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (C) 2021 V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
desc: ImportCall trailing comma following second parameter
|
||||
template: syntax/valid
|
||||
info: |
|
||||
ImportCall :
|
||||
import( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [import-assertions]
|
||||
---*/
|
||||
|
||||
//- import
|
||||
import('./empty_FIXTURE.js', {},)
|
|
@ -1,43 +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: Reports abrupt completions produced by 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).
|
||||
iii. IfAbruptRejectPromise(keys, promiseCapability).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions, Proxy]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var thrown = new Test262Error();
|
||||
var options = {
|
||||
assert: new Proxy({}, {
|
||||
ownKeys: function() {
|
||||
throw thrown;
|
||||
},
|
||||
})
|
||||
};
|
||||
|
||||
import('./2nd-param_FIXTURE.js', options)
|
||||
.then(function() {
|
||||
throw new Test262Error('Expected promise to be rejected, but promise was fulfilled.');
|
||||
}, function(error) {
|
||||
assert.sameValue(error, thrown);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,60 +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: >
|
||||
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']);
|
|
@ -1,58 +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: >
|
||||
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, Symbol, Proxy]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var symbol = Symbol('');
|
||||
var target = {
|
||||
[symbol]: '',
|
||||
unreported: '',
|
||||
nonEnumerable: ''
|
||||
};
|
||||
var descriptors = {
|
||||
[symbol]: {configurable: true, enumerable: true},
|
||||
nonEnumerable: {configurable: true, enumerable: false}
|
||||
};
|
||||
|
||||
var options = {
|
||||
assert: new Proxy({}, {
|
||||
ownKeys: function() {
|
||||
return [symbol, 'nonEnumerable', 'absent'];
|
||||
},
|
||||
get() {
|
||||
throw new Error("Should not be called");
|
||||
},
|
||||
getOwnPropertyDescriptor(target, name) {
|
||||
return descriptors[name];
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
import('./2nd-param_FIXTURE.js', options)
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -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: >
|
||||
Rejects promise when the `assert` property of the second argument is neither
|
||||
undefined nor an object
|
||||
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,
|
||||
1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a
|
||||
newly created TypeError object »).
|
||||
2. Return promiseCapability.[[Promise]].
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions, Symbol, BigInt]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
function test(promise, valueType) {
|
||||
return promise.then(function() {
|
||||
throw new Test262Error('Promise for ' + valueType + ' was not rejected.');
|
||||
}, function(error) {
|
||||
assert.sameValue(error.constructor, TypeError, valueType);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:null}), 'null'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:false}), 'boolean'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:23}), 'number'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:''}), 'string'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:Symbol('')}), 'symbol'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:23n}), 'bigint')
|
||||
])
|
||||
.then(function() {})
|
||||
.then($DONE, $DONE);
|
|
@ -1,36 +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: Accepts undefined for the `assert` property of the second argument
|
||||
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,
|
||||
1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a
|
||||
newly created TypeError object »).
|
||||
2. Return promiseCapability.[[Promise]].
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions, Symbol, BigInt]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
Promise.all([
|
||||
import('./2nd-param_FIXTURE.js', {}),
|
||||
import('./2nd-param_FIXTURE.js', {assert:undefined}),
|
||||
])
|
||||
.then(function(values) {
|
||||
assert.sameValue(values[0].default, 262);
|
||||
assert.sameValue(values[1].default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,34 +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: >
|
||||
Rejects promise when retrieving a value of the `assert` object produces an
|
||||
abrupt completion
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
|
||||
[...]
|
||||
10. If options is not undefined, then
|
||||
[...]
|
||||
d. If assertionsObj is not undefined,
|
||||
[...]
|
||||
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
|
||||
iii. IfAbruptRejectPromise(keys, promiseCapability).
|
||||
iv. Let supportedAssertions be ! HostGetSupportedImportAssertions().
|
||||
v. For each String key of keys,
|
||||
1. Let value be Get(assertionsObj, key).
|
||||
2. IfAbruptRejectPromise(value, promiseCapability).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var thrown = new Test262Error();
|
||||
|
||||
import('./2nd-param_FIXTURE.js', {assert:{get ''() { throw thrown; }}})
|
||||
.then(function() {
|
||||
throw new Test262Error('Expected promise to be rejected, but it was fulfilled');
|
||||
}, function(error) {
|
||||
assert.sameValue(error, thrown);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -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: >
|
||||
Rejects promise when any property of the `assert` object is not a string
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
|
||||
[...]
|
||||
10. If options is not undefined, then
|
||||
[...]
|
||||
d. If assertionsObj is not undefined,
|
||||
[...]
|
||||
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
|
||||
iii. IfAbruptRejectPromise(keys, promiseCapability).
|
||||
iv. Let supportedAssertions be ! HostGetSupportedImportAssertions().
|
||||
v. For each String key of keys,
|
||||
1. Let value be Get(assertionsObj, key).
|
||||
2. IfAbruptRejectPromise(value, promiseCapability).
|
||||
3. If Type(value) is not String, then
|
||||
a. Perform ! Call(promiseCapability.[[Reject]], undefined, « a
|
||||
newly created TypeError object »).
|
||||
b. Return promiseCapability.[[Promise]].
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions, Symbol, BigInt]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
function test(promise, valueType) {
|
||||
return promise.then(function() {
|
||||
throw new Test262Error('Promise for ' + valueType + ' was not rejected.');
|
||||
}, function(error) {
|
||||
assert.sameValue(error.constructor, TypeError, valueType);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': undefined}}), 'undefined'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': null}}), 'null'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': false}}), 'boolean'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': 23}}), 'number'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': Symbol('')}}), 'symbol'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': 23n}}), 'bigint'),
|
||||
test(import('./2nd-param_FIXTURE.js', {assert:{'': {}}}), 'object')
|
||||
])
|
||||
.then(function() {})
|
||||
.then($DONE, $DONE);
|
|
@ -1,21 +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: >
|
||||
ImportCall parameter list forwards the Await production parameter - AwaitExpression
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions, async-functions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
(async function () {
|
||||
return import('./2nd-param_FIXTURE.js', await undefined);
|
||||
}())
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,21 +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: >
|
||||
ImportCall parameter list forwards the Await production parameter - IdentifierReference
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions, async-functions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
function await() {}
|
||||
|
||||
import('./2nd-param_FIXTURE.js', await(undefined))
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,30 +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: Forwards "return" completion when evaluating second parameter
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
|
||||
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
|
||||
2. Let specifierRef be the result of evaluating specifierExpression.
|
||||
3. Let specifier be ? GetValue(specifierRef).
|
||||
4. If optionsExpression is present, then
|
||||
a. Let optionsRef be the result of evaluating optionsExpression.
|
||||
b. Let options be ? GetValue(optionsRef).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions]
|
||||
---*/
|
||||
|
||||
var beforeCount = 0;
|
||||
var afterCount = 0;
|
||||
var iter = function*() {
|
||||
beforeCount += 1, import('', yield), afterCount += 1;
|
||||
}();
|
||||
|
||||
iter.next();
|
||||
var result = iter.return(595);
|
||||
|
||||
assert.sameValue(result.done, true);
|
||||
assert.sameValue(result.value, 595);
|
||||
assert.sameValue(beforeCount, 1);
|
||||
assert.sameValue(afterCount, 0);
|
|
@ -1,29 +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: Forwards "throw" completion when evaluating second parameter
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
|
||||
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
|
||||
2. Let specifierRef be the result of evaluating specifierExpression.
|
||||
3. Let specifier be ? GetValue(specifierRef).
|
||||
4. If optionsExpression is present, then
|
||||
a. Let optionsRef be the result of evaluating optionsExpression.
|
||||
b. Let options be ? GetValue(optionsRef).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions]
|
||||
---*/
|
||||
|
||||
var beforeCount = 0;
|
||||
var afterCount = 0;
|
||||
function throwError() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
beforeCount += 1, import('', throwError()), afterCount += 1;
|
||||
});
|
||||
|
||||
assert.sameValue(beforeCount, 1);
|
||||
assert.sameValue(afterCount, 0);
|
|
@ -1,25 +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: Evaluates parameters in correct sequence
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
|
||||
1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
|
||||
2. Let specifierRef be the result of evaluating specifierExpression.
|
||||
3. Let specifier be ? GetValue(specifierRef).
|
||||
4. If optionsExpression is present, then
|
||||
a. Let optionsRef be the result of evaluating optionsExpression.
|
||||
b. Let options be ? GetValue(optionsRef).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions]
|
||||
---*/
|
||||
|
||||
var log = [];
|
||||
|
||||
import(log.push('first'), (log.push('second'), undefined))
|
||||
.then(null, function() {});
|
||||
|
||||
assert.sameValue(log.length, 2);
|
||||
assert.sameValue(log[0], 'first');
|
||||
assert.sameValue(log[1], 'second');
|
|
@ -1,36 +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: Rejects promise when accessing "assert" property throws an error
|
||||
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).
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var thrown = new Test262Error();
|
||||
var options = {
|
||||
get assert() {
|
||||
throw thrown;
|
||||
}
|
||||
};
|
||||
|
||||
import('./2nd-param_FIXTURE.js', options)
|
||||
.then(function() {
|
||||
throw new Test262Error('Expected an error, but observed no error');
|
||||
}, function(caught) {
|
||||
assert.sameValue(thrown, caught);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,22 +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: ImportCall parameter list enables the Yield production parameter
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var promise;
|
||||
|
||||
for (promise = import('./2nd-param_FIXTURE.js', 'test262' in {} || undefined); false; ) ;
|
||||
|
||||
promise
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,40 +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: >
|
||||
Rejects promise when the second argument is neither undefined nor an object
|
||||
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,
|
||||
i. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
|
||||
ii. Return promiseCapability.[[Promise]].
|
||||
[...]
|
||||
features: [dynamic-import, import-assertions, Symbol, BigInt]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
function test(promise, valueType) {
|
||||
return promise.then(function() {
|
||||
throw new Test262Error('Promise for ' + valueType + ' was not rejected.');
|
||||
}, function(error) {
|
||||
assert.sameValue(error.constructor, TypeError, valueType);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
test(import('./2nd-param_FIXTURE.js', null), 'null'),
|
||||
test(import('./2nd-param_FIXTURE.js', false), 'boolean'),
|
||||
test(import('./2nd-param_FIXTURE.js', 23), 'number'),
|
||||
test(import('./2nd-param_FIXTURE.js', ''), 'string'),
|
||||
test(import('./2nd-param_FIXTURE.js', Symbol('')), 'symbol'),
|
||||
test(import('./2nd-param_FIXTURE.js', 23n), 'bigint')
|
||||
])
|
||||
.then(function() {})
|
||||
.then($DONE, $DONE);
|
|
@ -1,20 +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: >
|
||||
ImportCall parameter list supports an optional trailing comma (fulfillment
|
||||
semantics)
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
import('./2nd-param_FIXTURE.js', {},)
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,24 +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: >
|
||||
ImportCall parameter list supports an optional trailing comma (rejection
|
||||
semantics)
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var thrown = new Test262Error();
|
||||
|
||||
import({toString: function() { throw thrown; } }, {},)
|
||||
.then(function() {
|
||||
throw new Test262Error('Expected promise to be rejected, but it was fulfilled.');
|
||||
}, function(caught) {
|
||||
assert.sameValue(thrown, caught);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,31 +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: >
|
||||
ImportCall parameter list forwards the Yield production parameter - YieldExpression
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var promise;
|
||||
|
||||
var iter = (function * () {
|
||||
promise = import('./2nd-param_FIXTURE.js', yield);
|
||||
}());
|
||||
|
||||
iter.next();
|
||||
|
||||
assert.sameValue(promise, undefined);
|
||||
|
||||
iter.next();
|
||||
|
||||
promise
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,19 +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: >
|
||||
ImportCall parameter list forwards the Yield production parameter - invalid IdentifierReference
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [onlyStrict]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import('./empty_FIXTURE.js', yield);
|
|
@ -1,21 +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: >
|
||||
ImportCall parameter list forwards the Yield production parameter - valid IdentifierReference
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async, noStrict]
|
||||
---*/
|
||||
|
||||
var yield;
|
||||
|
||||
import('./2nd-param_FIXTURE.js', yield)
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,3 +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.
|
||||
export default 262;
|
|
@ -1 +0,0 @@
|
|||
262
|
|
@ -1,2 +0,0 @@
|
|||
Make sure to keep the tests in this folder aligned
|
||||
with the tests in the import-attributes folder.
|
|
@ -1,20 +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: >
|
||||
ImportCall parameter list supports an optional trailing comma (fulfillment
|
||||
semantics)
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
import('./2nd-param_FIXTURE.js',)
|
||||
.then(function(module) {
|
||||
assert.sameValue(module.default, 262);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,24 +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: >
|
||||
ImportCall parameter list supports an optional trailing comma (rejection
|
||||
semantics)
|
||||
esid: sec-import-call-runtime-semantics-evaluation
|
||||
info: |
|
||||
ImportCall[Yield, Await]:
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt )
|
||||
features: [dynamic-import, import-assertions]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
var thrown = new Test262Error();
|
||||
|
||||
import({toString: function() { throw thrown; } },)
|
||||
.then(function() {
|
||||
throw new Test262Error('Expected promise to be rejected, but it was fulfilled.');
|
||||
}, function(caught) {
|
||||
assert.sameValue(thrown, caught);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,2 +0,0 @@
|
|||
Make sure to keep the tests in this folder aligned
|
||||
with the tests in the import-attributes folder.
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Creates extensible arrays
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-array_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
value.test262property = 'test262 value';
|
||||
|
||||
verifyProperty(value, 'test262property', {
|
||||
value: 'test262 value',
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Creates extensible objects
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-object_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
value.test262property = 'test262 value';
|
||||
|
||||
verifyProperty(value, 'test262property', {
|
||||
value: 'test262 value',
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
|
@ -1,6 +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.
|
||||
|
||||
import value from './json-idempotency_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
globalThis.viaSecondModule = value;
|
|
@ -1,21 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: The same object representation is returned to all import sites
|
||||
flags: [module, async]
|
||||
features: [import-assertions, json-modules, globalThis, dynamic-import]
|
||||
---*/
|
||||
|
||||
import viaStaticImport1 from './json-idempotency_FIXTURE.json' assert { type: 'json' };
|
||||
import {default as viaStaticImport2} from './json-idempotency_FIXTURE.json' assert { type: 'json' };
|
||||
import './json-idempotency-indirect_FIXTURE.js';
|
||||
|
||||
assert.sameValue(viaStaticImport1, viaStaticImport2);
|
||||
assert.sameValue(globalThis.viaSecondModule, viaStaticImport1);
|
||||
|
||||
import('./json-idempotency_FIXTURE.json', { assert: { type: 'json' } })
|
||||
.then(function(viaDynamicImport) {
|
||||
assert.sameValue(viaDynamicImport.default, viaStaticImport1);
|
||||
})
|
||||
.then($DONE, $DONE);
|
|
@ -1,23 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Does not define
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import value from './json-invalid_FIXTURE.json' assert { type: 'json' };
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
notJson: 0
|
||||
}
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Does not define named bindings
|
||||
info: |
|
||||
In the early design of JSON modules, contributors considered allowing the
|
||||
properties of object values in JSON modules to be imported directly by name.
|
||||
This was ultimately rejected, so attempting to import in this way should
|
||||
produce a SyntaxError.
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import {name} from './json-named-bindings_FIXTURE.json' assert { type: 'json' };
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"name": 0
|
||||
}
|
|
@ -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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of an array
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
|
||||
To more fully verify parsing correctness, the source text of the imported
|
||||
module record includes non-printable characters (specifically, all four forms
|
||||
of JSON's so-called "whitespace" token) both before and after the "value."
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-array_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert(Array.isArray(value), 'the exported value is an array');
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(value),
|
||||
Array.prototype,
|
||||
'the exported value is not a subclass of Array'
|
||||
);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value).length, 7);
|
||||
assert.sameValue(value.length, 6);
|
||||
|
||||
assert.sameValue(value[0], -1.2345);
|
||||
assert.sameValue(value[1], true);
|
||||
assert.sameValue(value[2], 'a string value');
|
||||
assert.sameValue(value[3], null);
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(value[4]), Object.prototype);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value[4]).length, 0);
|
||||
|
||||
assert(Array.isArray(value[5]), 'the fifth element is an array');
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(value[5]),
|
||||
Array.prototype,
|
||||
'the fifth element is not a subclass of Array'
|
||||
);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value[5]).length, 1);
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
[
|
||||
-1234.500e-003,
|
||||
true,
|
||||
"a string value",
|
||||
null,
|
||||
{},
|
||||
[]
|
||||
]
|
||||
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of a boolean
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-boolean_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(value, true);
|
|
@ -1 +0,0 @@
|
|||
true
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of null
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-null_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(value, null);
|
|
@ -1 +0,0 @@
|
|||
null
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of a number
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-number_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(value, -1.2345);
|
|
@ -1 +0,0 @@
|
|||
-1234.500e-003
|
|
@ -1,67 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of an ordinary object
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
|
||||
To more fully verify parsing correctness, the source text of the imported
|
||||
module record includes non-printable characters (specifically, all four forms
|
||||
of JSON's so-called "whitespace" token) both before and after the "value."
|
||||
flags: [module]
|
||||
includes: [propertyHelper.js]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-object_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(value), Object.prototype);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value).length, 6);
|
||||
|
||||
verifyProperty(value, 'number', {
|
||||
value: -1.2345,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
verifyProperty(value, 'boolean', {
|
||||
value: true,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
verifyProperty(value, 'string', {
|
||||
value: 'a string value',
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
verifyProperty(value, 'null', {
|
||||
value: null,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(value.object), Object.prototype);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value.object).length, 0);
|
||||
|
||||
assert(
|
||||
Array.isArray(value.array), 'the value of the "array" property is an array'
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(value.array),
|
||||
Array.prototype,
|
||||
'the value of the "array" property is not a subclass of Array'
|
||||
);
|
||||
assert.sameValue(Object.getOwnPropertyNames(value.array).length, 1);
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
{
|
||||
"number": -1234.500e-003,
|
||||
"boolean": true,
|
||||
"string": "a string value",
|
||||
"null": null,
|
||||
"object": {},
|
||||
"array": []
|
||||
}
|
||||
|
|
@ -1,20 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: Correctly parses the JSON representation of a string
|
||||
info: |
|
||||
# 1.4 ParseJSONModule ( source )
|
||||
|
||||
The abstract operation ParseJSONModule takes a single argument source which
|
||||
is a String representing the contents of a module.
|
||||
|
||||
1. Let json be ? Call(%JSON.parse%, undefined, « source »).
|
||||
2. Return CreateDefaultExportSyntheticModule(json).
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import value from './json-value-string_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(value, 'a string value');
|
|
@ -1 +0,0 @@
|
|||
"a string value"
|
|
@ -1,13 +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.
|
||||
/*---
|
||||
esid: sec-parse-json-module
|
||||
description: May be imported via a module namespace object
|
||||
flags: [module]
|
||||
features: [import-assertions, json-modules]
|
||||
---*/
|
||||
|
||||
import * as ns from './json-via-namespace_FIXTURE.json' assert { type: 'json' };
|
||||
|
||||
assert.sameValue(Object.getOwnPropertyNames(ns).length, 1);
|
||||
assert.sameValue(ns.default, 262);
|
|
@ -1 +0,0 @@
|
|||
262
|
|
@ -1,2 +0,0 @@
|
|||
Make sure to keep the tests in this folder aligned
|
||||
with the tests in the import-attributes folder.
|
|
@ -1,23 +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: WithClause may not have duplicate keys (export declaration)
|
||||
esid: sec-modules
|
||||
info: |
|
||||
WithClause: AttributesKeyword { WithEntries,opt }
|
||||
|
||||
- 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]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
export * from './import-assertion-3_FIXTURE.js' assert {
|
||||
type: 'json',
|
||||
'typ\u0065': ''
|
||||
};
|
|
@ -1,24 +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: >
|
||||
WithClause may not have duplicate keys (import declaration without binding)
|
||||
esid: sec-modules
|
||||
info: |
|
||||
WithClause: AttributesKeyword { WithEntries,opt }
|
||||
|
||||
- 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]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import './import-assertion-2_FIXTURE.js' assert {
|
||||
type: 'json',
|
||||
'typ\u0065': ''
|
||||
};
|
|
@ -1,24 +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: >
|
||||
WithClause may not have duplicate keys (import declaration with binding)
|
||||
esid: sec-modules
|
||||
info: |
|
||||
WithClause: AttributesKeyword { WithEntries,opt }
|
||||
|
||||
- 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]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import x from './import-assertion-1_FIXTURE.js' assert {
|
||||
type: 'json',
|
||||
'typ\u0065': ''
|
||||
};
|
|
@ -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';
|
||||
}
|
|
@ -1,3 +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.
|
||||
export default 262.1;
|
|
@ -1,3 +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.
|
||||
export default 262.2;
|
|
@ -1,3 +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.
|
||||
export default 262.3;
|
|
@ -1,29 +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: WithClause in ImportDeclaration may be empty
|
||||
esid: sec-modules
|
||||
info: |
|
||||
ImportDeclaration:
|
||||
import ModuleSpecifier[no LineTerminator here] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
import x from './import-assertion-1_FIXTURE.js' assert {};
|
||||
import './import-assertion-2_FIXTURE.js' assert {};
|
||||
export * from './import-assertion-3_FIXTURE.js' assert {};
|
||||
|
||||
assert.sameValue(x, 262.1);
|
|
@ -1,37 +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: >
|
||||
WithClause in ImportDeclaration may use any valid IdentifierName as a key
|
||||
esid: sec-modules
|
||||
info: |
|
||||
ImportDeclaration:
|
||||
import ModuleSpecifier[no LineTerminator here] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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);
|
|
@ -1,37 +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: >
|
||||
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] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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);
|
|
@ -1,37 +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: >
|
||||
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] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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);
|
|
@ -1,35 +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: >
|
||||
WithClause in ImportDeclaration may contain multiple WithEntries
|
||||
esid: sec-modules
|
||||
info: |
|
||||
ImportDeclaration:
|
||||
import ModuleSpecifier[no LineTerminator here] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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:''};
|
|
@ -1,71 +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: >
|
||||
WithClause in ImportDeclaration may include line terminators
|
||||
esid: sec-modules
|
||||
info: |
|
||||
ImportDeclaration:
|
||||
import ModuleSpecifier[no LineTerminator here] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
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 "../resources/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);
|
|
@ -1,35 +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: >
|
||||
WithClause in ImportDeclaration may contain a trailing comma
|
||||
esid: sec-modules
|
||||
info: |
|
||||
ImportDeclaration:
|
||||
import ModuleSpecifier[no LineTerminator here] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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:'',};
|
|
@ -1,35 +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: >
|
||||
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] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
features: [import-assertions, globalThis]
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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"};
|
|
@ -1,35 +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: >
|
||||
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] WithClause;
|
||||
|
||||
WithClause:
|
||||
assert {}
|
||||
assert {WithEntries ,opt}
|
||||
|
||||
WithEntries:
|
||||
AttributeKey : StringLiteral
|
||||
AttributeKey : StringLiteral , WithEntries
|
||||
|
||||
AttributeKey:
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
features: [import-assertions, globalThis]
|
||||
negative:
|
||||
phase: resolution
|
||||
type: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
import "../resources/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'};
|
Loading…
Reference in New Issue