Skip to content

Commit 47df386

Browse files
authored
Merge branch 'main' into merge-and-extract-calendar-number-and-wrong-type-tests
2 parents 2e56fc1 + cf4c281 commit 47df386

File tree

141 files changed

+9783
-3579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+9783
-3579
lines changed

.circleci/config.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ jobs:
6868
hostPath: spidermonkey
6969
hostName: spidermonkey
7070
<<: [*execution_steps]
71-
# "ChakraCore: New or modified tests execution":
72-
# docker:
73-
# - image: *node_image
74-
# working_directory: ~/test262
75-
# environment:
76-
# hostType: ch
77-
# hostPath: chakra
78-
# hostName: chakra
79-
# <<: [*execution_steps]
8071
"JSC: New or modified tests execution":
8172
docker:
8273
- image: *node_image
@@ -110,7 +101,6 @@ workflows:
110101
version: 2
111102
Tests execution:
112103
jobs:
113-
# - "ChakraCore: New or modified tests execution"
114104
- "JSC: New or modified tests execution"
115105
- "SpiderMonkey: New or modified tests execution"
116106
- "V8: New or modified tests execution"

.github/workflows/checks.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ jobs:
5050
- name: Create annotations in the PR
5151
if: failure() && github.event_name == 'pull_request'
5252
run: |
53-
awk -F': ' <errors.out \
54-
"{ sub(\"$(pwd)/\", \"\"); printf \"::error file=%s,line=1::%s\n\", \$1, \$2 }"
53+
awk -v cwd="$(pwd)/" <errors.out '{
54+
if (index($0, cwd)==1) $0=substr($0, length(cwd)+1);
55+
i=index($0, ": ");
56+
printf "::error file=%s,line=1::%s\n", substr($0, 1, i-1), substr($0, i+2);
57+
}'
5558
5659
5760
build:

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ function Test262Error(message) {
299299

300300
The [Module section of INTERPRETING.md](https://github.com/tc39/test262/blob/HEAD/INTERPRETING.md#modules) states that `_FIXTURE` files will not have Realm modifications applied. In practice, this means that code in `_FIXTURE` files must abide by the following rules:
301301

302-
- **MUST NOT** refer to, or make use of any [Test262-Defined Bindings](https://github.com/tc39/test262/blob/HEAD/INTERPRETING.md#test262-defined-bindings) in any way.
303-
- **MUST NOT** refer to, or make use of any [Host-Defined Functions](https://github.com/tc39/test262/blob/HEAD/INTERPRETING.md#host-defined-functions) in any way.
302+
- **MUST NOT** refer to, or make use of any [Test262-Defined Bindings](https://github.com/tc39/test262/blob/HEAD/INTERPRETING.md#test262-defined-bindings) in any way.
303+
- **MUST NOT** refer to, or make use of any [Host-Defined Functions](https://github.com/tc39/test262/blob/HEAD/INTERPRETING.md#host-defined-functions) in any way.
304304

305305
## Handling Errors and Negative Test Cases
306306

@@ -458,14 +458,14 @@ Tests expressed with this convention are built automatically following the sourc
458458

459459
## Reporting Bugs to Implementers
460460

461-
- [ChakraCore](https://github.com/microsoft/ChakraCore/issues/new)
461+
- [Boa](https://github.com/boa-dev/boa/issues/new)
462+
- [ChakraCore](https://github.com/chakra-core/ChakraCore/issues/new)
462463
- [engine262](https://github.com/engine262/engine262/issues/new)
463464
- [GraalJS](https://github.com/oracle/graal/issues/new?labels=bug&template=5_issues_other.md&title=)
464465
- [Hermes](https://github.com/facebook/hermes/issues/new?labels%5B%5D=need+triage&labels%5B%5D=bug&template=01_bug_report.md&title=)
465466
- [JavaScriptCore](https://bugs.webkit.org/enter_bug.cgi?product=WebKit&component=JavaScriptCore)
467+
- [Kiesel](https://codeberg.org/kiesel-js/kiesel/issues/new)
466468
- [Moddable XS](https://github.com/Moddable-OpenSource/moddable/issues/new?assignees=&labels=&template=bug_report.md&title=)
467469
- [QuickJS](https://github.com/bellard/quickjs/issues/new)
468470
- [SpiderMonkey](https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=JavaScript%20Engine)
469471
- [V8](https://bugs.chromium.org/p/v8/issues/entry)
470-
471-

INTERPRETING.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ properties of the global scope prior to test execution.
7171
- **`IsHTMLDDA`** - (present only in implementations that can provide it) an
7272
object that:
7373

74-
1. has an [[IsHTMLDDA]] internal slot, and
75-
2. when called with no arguments or with the first argument `""` (an empty string) returns `null`.
74+
1. has an [[IsHTMLDDA]] internal slot, and
75+
2. when called with no arguments or with the first argument `""` (an empty string) returns `null`.
76+
77+
Note: The peculiar second requirement permits testing algorithms when they also call `document.all` with such arguments, so that testing for correct behavior requires knowing how the call behaves. This is rarely necessary.
7678

77-
Note: The peculiar second requirement permits testing algorithms when they also call `document.all` with such arguments, so that testing for correct behavior requires knowing how the call behaves. This is rarely necessary.
78-
7979
Use this property to test that ECMAScript algorithms aren't mis-implemented to treat `document.all` as being `undefined` or of type Undefined (instead of Object).
80-
80+
8181
**Tests using this function must be tagged with the `IsHTMLDDA` feature so that only hosts supporting this property will run them.**
8282
- **`agent`** - an ordinary object with the following properties:
8383
- **`start`** - a function that takes a script source string and runs
@@ -98,10 +98,10 @@ properties of the global scope prior to test execution.
9898
- **`leaving`** - a function that signals that the agent is done and
9999
may be terminated (if possible).
100100
- **`monotonicNow`** - a function that returns a value that conforms to [`DOMHighResTimeStamp`][] and is produced in such a way that its semantics conform to **[Monotonic Clock][]**.
101-
- **`broadcast`** - a function that takes a SharedArrayBuffer and an
102-
Int32 or BigInt and broadcasts the two values to all concurrent
103-
agents. The function blocks until all agents have retrieved the
104-
message. Note, this assumes that all agents that were started are
101+
- **`broadcast`** - a function that takes a SharedArrayBuffer and an
102+
Int32 or BigInt and broadcasts the two values to all concurrent
103+
agents. The function blocks until all agents have retrieved the
104+
message. Note, this assumes that all agents that were started are
105105
still running.
106106
- **`getReport`** - a function that reads an incoming string from any agent,
107107
and returns it if it exists, or returns `null` otherwise.
@@ -208,15 +208,15 @@ an exception, or if the name of the thrown exception's constructor does not
208208
match the specified constructor name, or if the error occurs at a phase that
209209
differs from the indicated phase, the test must be interpreted as "failing."
210210

211-
The **`$DONOTEVALUATE()`** function is for use in tests that include the following meta data:
211+
The **`$DONOTEVALUATE()`** function is for use in tests that include the following meta data:
212212

213213
```
214214
negative:
215215
phase: runtime
216216
type: ReferenceError
217217
```
218218

219-
The definition is considered "runner implementation defined" and no guarantees can be made about its behavior, therefore it is restricted to only tests that meet the criteria described above.
219+
The definition is considered "runner implementation defined" and no guarantees can be made about its behavior, therefore it is restricted to only tests that meet the criteria described above.
220220

221221
*Examples:*
222222

@@ -258,8 +258,11 @@ export {} from './instn-resolve-empty-export_FIXTURE.js';
258258
### `includes`
259259

260260
One or more files whose content must be evaluated in the test realm's global
261-
scope prior to test execution. These files are located within the `harness/`
262-
directory of the Test262 project.
261+
scope prior to test execution, after the files listed in the
262+
[Test262-Defined Bindings](#test262-defined-bindings) section and the file
263+
listed for the `async` flag below.
264+
They must be included in the order given in the source.
265+
These files are located within the `harness/` directory of the Test262 project.
263266

264267
*Example*
265268

@@ -348,9 +351,11 @@ following strings:
348351
```
349352

350353
- **`async`** The file `harness/doneprintHandle.js` must be evaluated in the
351-
test realm's global scope prior to test execution. The test must not be
352-
considered complete until the implementation-defined `print` function has
353-
been invoked or some length of time has passed without any such invocation.
354+
test realm's global scope prior to test execution, after the files listed in
355+
the [Test262-Defined Bindings](#test262-defined-bindings) section.
356+
The test must not be considered complete until the implementation-defined
357+
`print` function has been invoked or some length of time has passed without
358+
any such invocation.
354359
In the event of a passing test run, this function will be invoked with the
355360
string `'Test262:AsyncTestComplete'`. If invoked with a string that is
356361
prefixed with the character sequence `Test262:AsyncTestFailure:`, the test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This project offers an explanation for many of its design decisions and maintena
4242

4343
Volunteer-maintained projects that may be used to execute Test262 in various ECMAScript hosts:
4444

45-
- https://github.com/bterlson/test262-harness (platform: Node.js)
45+
- https://github.com/tc39/test262-harness (platform: Node.js)
4646
- https://github.com/test262-utils/test262-harness-py (platform: Python)
4747
- https://bakkot.github.io/test262-web-runner/ (platform: web)
4848
- https://github.com/Izhido/test262_harness_cpp (platform: C++)

harness/hidden-constructors.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

harness/wellKnownIntrinsicObjects.js

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*---
44
description: |
55
An Array of all representable Well-Known Intrinsic Objects
6-
defines: [WellKnownIntrinsicObjects]
6+
defines: [WellKnownIntrinsicObjects, getWellKnownIntrinsicObject]
77
---*/
88

99
const WellKnownIntrinsicObjects = [
@@ -24,16 +24,21 @@ const WellKnownIntrinsicObjects = [
2424
source: 'Object.getPrototypeOf([][Symbol.iterator]())',
2525
},
2626
{
27+
// Not currently accessible to ECMAScript user code
2728
name: '%AsyncFromSyncIteratorPrototype%',
28-
source: 'undefined',
29+
source: '',
2930
},
3031
{
3132
name: '%AsyncFunction%',
3233
source: '(async function() {}).constructor',
3334
},
3435
{
3536
name: '%AsyncGeneratorFunction%',
36-
source: 'Object.getPrototypeOf(async function * () {})',
37+
source: '(async function* () {}).constructor',
38+
},
39+
{
40+
name: '%AsyncGeneratorPrototype%',
41+
source: 'Object.getPrototypeOf(async function* () {}).prototype',
3742
},
3843
{
3944
name: '%AsyncIteratorPrototype%',
@@ -108,6 +113,7 @@ const WellKnownIntrinsicObjects = [
108113
source: 'Float64Array',
109114
},
110115
{
116+
// Not currently accessible to ECMAScript user code
111117
name: '%ForInIteratorPrototype%',
112118
source: '',
113119
},
@@ -117,7 +123,11 @@ const WellKnownIntrinsicObjects = [
117123
},
118124
{
119125
name: '%GeneratorFunction%',
120-
source: 'Object.getPrototypeOf(function * () {})',
126+
source: '(function* () {}).constructor',
127+
},
128+
{
129+
name: '%GeneratorPrototype%',
130+
source: 'Object.getPrototypeOf(function * () {}).prototype',
121131
},
122132
{
123133
name: '%Int8Array%',
@@ -140,8 +150,12 @@ const WellKnownIntrinsicObjects = [
140150
source: 'isNaN',
141151
},
142152
{
143-
name: '%IteratorPrototype%',
144-
source: 'Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))',
153+
name: '%Iterator%',
154+
source: 'typeof Iterator !== "undefined" ? Iterator : Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())).constructor',
155+
},
156+
{
157+
name: '%IteratorHelperPrototype%',
158+
source: 'Object.getPrototypeOf(Iterator.from([]).drop(0))',
145159
},
146160
{
147161
name: '%JSON%',
@@ -275,6 +289,10 @@ const WellKnownIntrinsicObjects = [
275289
name: '%WeakSet%',
276290
source: 'WeakSet',
277291
},
292+
{
293+
name: '%WrapForValidIteratorPrototype%',
294+
source: 'Object.getPrototypeOf(Iterator.from({ [Symbol.iterator](){ return {}; } }))',
295+
},
278296
];
279297

280298
WellKnownIntrinsicObjects.forEach((wkio) => {
@@ -288,3 +306,22 @@ WellKnownIntrinsicObjects.forEach((wkio) => {
288306

289307
wkio.value = actual;
290308
});
309+
310+
/**
311+
* Returns a well-known intrinsic object, if the implementation provides it.
312+
* Otherwise, throws.
313+
* @param {string} key - the specification's name for the intrinsic, for example
314+
* "%Array%"
315+
* @returns {object} the well-known intrinsic object.
316+
*/
317+
function getWellKnownIntrinsicObject(key) {
318+
for (var ix = 0; ix < WellKnownIntrinsicObjects.length; ix++) {
319+
if (WellKnownIntrinsicObjects[ix].name === key) {
320+
var value = WellKnownIntrinsicObjects[ix].value;
321+
if (value !== undefined)
322+
return value;
323+
throw new Test262Error('this implementation could not obtain ' + key);
324+
}
325+
}
326+
throw new Test262Error('unknown well-known intrinsic ' + key);
327+
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
"ci": "./tools/scripts/ci_test.sh",
2121
"test": "test262-harness",
2222
"diff": "git diff --diff-filter ACMR --name-only main.. -- test/ && git ls-files --exclude-standard --others -- test/",
23-
"test:diff": "npm run test:diff:v8 && npm run test:diff:spidermonkey && npm run test:diff:chakra && npm run test:diff:javascriptcore",
23+
"test:diff": "npm run test:diff:v8 && npm run test:diff:spidermonkey && npm run test:diff:javascriptcore",
2424
"test:diff:v8": "test262-harness -t 8 --hostType=d8 --hostPath=v8 $(npm run --silent diff)",
2525
"test:diff:spidermonkey": "test262-harness -t 8 --hostType=jsshell --hostPath=spidermonkey $(npm run --silent diff)",
26-
"test:diff:chakra": "test262-harness -t 8 --hostType=ch --hostPath=chakra $(npm run --silent diff)",
2726
"test:diff:javascriptcore": "test262-harness -t 8 --hostType=jsc --hostPath=javascriptcore $(npm run --silent diff)",
2827
"test:diff:xs": "test262-harness -t 8 --hostType=xs --hostPath=xs $(npm run --silent diff)"
2928
}

test/built-ins/AsyncFunction/is-a-constructor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ info: |
1515
If Type(argument) is not Object, return false.
1616
If argument has a [[Construct]] internal method, return true.
1717
Return false.
18-
includes: [isConstructor.js, hidden-constructors.js]
18+
includes: [isConstructor.js, wellKnownIntrinsicObjects.js]
1919
features: [Reflect.construct]
2020
---*/
2121

22+
var AsyncFunction = getWellKnownIntrinsicObject('%AsyncFunction%');
2223
assert.sameValue(isConstructor(AsyncFunction), true, 'isConstructor(AsyncFunction) must return true');
2324
new AsyncFunction();
24-

test/built-ins/AsyncGeneratorFunction/is-a-constructor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ info: |
1515
If Type(argument) is not Object, return false.
1616
If argument has a [[Construct]] internal method, return true.
1717
Return false.
18-
includes: [isConstructor.js, hidden-constructors.js]
18+
includes: [isConstructor.js, wellKnownIntrinsicObjects.js]
1919
features: [Reflect.construct]
2020
---*/
2121

22+
var AsyncGeneratorFunction = getWellKnownIntrinsicObject('%AsyncGeneratorFunction%');
2223
assert.sameValue(
2324
isConstructor(AsyncGeneratorFunction),
2425
true,
2526
'isConstructor(AsyncGeneratorFunction) must return true'
2627
);
2728
new AsyncGeneratorFunction();
28-

0 commit comments

Comments
 (0)