forked from tc39/test262
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update import attributes
assert
tests to current semantics (tc39#3919)
Co-authored-by: Jordan Harband <ljharb@gmail.com>
- Loading branch information
1 parent
e98bfb3
commit 1bb53ae
Showing
19 changed files
with
261 additions
and
171 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...guage/expressions/dynamic-import/import-assertions/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
60 changes: 60 additions & 0 deletions
60
...e/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.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,60 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: > | ||
Follows the semantics of the EnumerableOwnPropertyNames abstract operation | ||
during attributes enumeration | ||
esid: sec-import-call-runtime-semantics-evaluation | ||
info: | | ||
2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) | ||
[...] | ||
6. Let promiseCapability be ! NewPromiseCapability(%Promise%). | ||
7. Let specifierString be ToString(specifier). | ||
8. IfAbruptRejectPromise(specifierString, promiseCapability). | ||
9. Let assertions be a new empty List. | ||
10. If options is not undefined, then | ||
a. If Type(options) is not Object, | ||
[...] | ||
b. Let assertionsObj be Get(options, "assert"). | ||
c. IfAbruptRejectPromise(assertionsObj, promiseCapability). | ||
d. If assertionsObj is not undefined, | ||
i. If Type(assertionsObj) is not Object, | ||
[...] | ||
ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). | ||
[...] | ||
features: [dynamic-import, import-assertions, json-modules, Symbol, Proxy] | ||
includes: [compareArray.js] | ||
flags: [async] | ||
---*/ | ||
|
||
var symbol = Symbol(''); | ||
var target = { | ||
type: "json" | ||
}; | ||
var descriptors = { | ||
type: {configurable: true, enumerable: true} | ||
}; | ||
var log = []; | ||
|
||
var options = { | ||
assert: new Proxy({}, { | ||
ownKeys: function() { | ||
return ["type"]; | ||
}, | ||
get(_, name) { | ||
log.push(name); | ||
return "json"; | ||
}, | ||
getOwnPropertyDescriptor(target, name) { | ||
return {configurable: true, enumerable: true, value: "json"}; | ||
}, | ||
}) | ||
}; | ||
|
||
import('./2nd-param_FIXTURE.json', options) | ||
.then(function(module) { | ||
assert.sameValue(module.default, 262); | ||
}) | ||
.then($DONE, $DONE); | ||
|
||
assert.compareArray(log, ['type']); |
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
1 change: 1 addition & 0 deletions
1
test/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json
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 @@ | ||
262 |
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 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
9 changes: 9 additions & 0 deletions
9
test/language/module-code/import-assertions/ensure-linking-error_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,9 @@ | ||
// Copyright (C) 2022 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
// When imported, this file will ensure that a linking error happens by | ||
// importing a non-existent binding. | ||
// It can be used to assert that there is a linking error, which means | ||
// that there are no parsing errors. | ||
|
||
import { nonExistent } from "./import-assertion-ensure-resolution-error_FIXTURE.js"; |
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
2 changes: 1 addition & 1 deletion
2
test/language/module-code/import-assertions/import-assertion-2_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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Copyright (C) 2021 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
globalThis.test262 = 262.2; | ||
export default 262.2; |
16 changes: 8 additions & 8 deletions
16
test/language/module-code/import-assertions/import-assertion-empty.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
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
Oops, something went wrong.