-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
219ad6f
commit 18834b2
Showing
43 changed files
with
1,145 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 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',) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 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', {},) |
43 changes: 43 additions & 0 deletions
43
test/language/expressions/dynamic-import/2nd-param-assert-enumeration-abrupt.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: Reports abrupt completions produced by assertion enumeration | ||
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); |
68 changes: 68 additions & 0 deletions
68
test/language/expressions/dynamic-import/2nd-param-assert-enumeration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// 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 assertion 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 = { | ||
enumerable1: '', | ||
enumerable2: '', | ||
[symbol]: '', | ||
unreported: '', | ||
nonEnumerable: '' | ||
}; | ||
var descriptors = { | ||
enumerable1: {configurable: true, enumerable: true}, | ||
enumerable2: {configurable: true, enumerable: true}, | ||
[symbol]: {configurable: true, enumerable: true}, | ||
nonEnumerable: {configurable: true, enumerable: false} | ||
}; | ||
var log = []; | ||
|
||
var options = { | ||
assert: new Proxy({}, { | ||
ownKeys: function() { | ||
return ['enumerable1', symbol, 'nonEnumerable', 'absent', 'enumerable2']; | ||
}, | ||
get(_, name) { | ||
log.push(name); | ||
return target[name]; | ||
}, | ||
getOwnPropertyDescriptor(target, name) { | ||
return descriptors[name]; | ||
} | ||
}) | ||
}; | ||
|
||
import('./2nd-param_FIXTURE.js', options) | ||
.then(function(module) { | ||
assert.sameValue(module.default, 262); | ||
}) | ||
.then($DONE, $DONE); | ||
|
||
assert.sameValue(log.length, 2); | ||
assert.sameValue(log[0], 'enumerable1'); | ||
assert.sameValue(log[1], 'enumerable2'); |
47 changes: 47 additions & 0 deletions
47
test/language/expressions/dynamic-import/2nd-param-assert-non-object.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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); |
36 changes: 36 additions & 0 deletions
36
test/language/expressions/dynamic-import/2nd-param-assert-undefined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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); |
34 changes: 34 additions & 0 deletions
34
test/language/expressions/dynamic-import/2nd-param-assert-value-abrupt.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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); |
47 changes: 47 additions & 0 deletions
47
test/language/expressions/dynamic-import/2nd-param-assert-value-non-string.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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); |
21 changes: 21 additions & 0 deletions
21
test/language/expressions/dynamic-import/2nd-param-await-expr.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
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); |
21 changes: 21 additions & 0 deletions
21
test/language/expressions/dynamic-import/2nd-param-await-ident.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
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); |
Oops, something went wrong.