-
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.
Merge branch 'main' into remove-jshint-conf
- Loading branch information
Showing
205 changed files
with
5,247 additions
and
271 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
31 changes: 31 additions & 0 deletions
31
test/built-ins/Array/prototype/Symbol.unscopables/array-find-from-last.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,31 @@ | ||
// Copyright (C) 2022 Microsoft. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-array.prototype-@@unscopables | ||
description: > | ||
Initial value of `Symbol.unscopables` property | ||
info: | | ||
22.1.3.32 Array.prototype [ @@unscopables ] | ||
... | ||
7. Perform CreateDataProperty(unscopableList, "findLast", true). | ||
8. Perform CreateDataProperty(unscopableList, "findLastIndex", true). | ||
... | ||
includes: [propertyHelper.js] | ||
features: [Symbol.unscopables, array-find-from-last] | ||
---*/ | ||
|
||
var unscopables = Array.prototype[Symbol.unscopables]; | ||
|
||
assert.sameValue(Object.getPrototypeOf(unscopables), null); | ||
|
||
assert.sameValue(unscopables.findLast, true, '`findLast` property value'); | ||
verifyEnumerable(unscopables, 'findLast'); | ||
verifyWritable(unscopables, 'findLast'); | ||
verifyConfigurable(unscopables, 'findLast'); | ||
|
||
assert.sameValue(unscopables.findLastIndex, true, '`findLastIndex` property value'); | ||
verifyEnumerable(unscopables, 'findLastIndex'); | ||
verifyWritable(unscopables, 'findLastIndex'); | ||
verifyConfigurable(unscopables, 'findLastIndex'); |
31 changes: 31 additions & 0 deletions
31
test/built-ins/Array/prototype/Symbol.unscopables/array-grouping.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,31 @@ | ||
// Copyright (C) 2022 Chengzhong Wu. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-array.prototype-@@unscopables | ||
description: > | ||
Initial value of `Symbol.unscopables` property | ||
info: | | ||
22.1.3.32 Array.prototype [ @@unscopables ] | ||
... | ||
10. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupBy", true). | ||
11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupByToMap", true). | ||
... | ||
includes: [propertyHelper.js] | ||
features: [Symbol.unscopables, array-grouping] | ||
---*/ | ||
|
||
var unscopables = Array.prototype[Symbol.unscopables]; | ||
|
||
assert.sameValue(Object.getPrototypeOf(unscopables), null); | ||
|
||
assert.sameValue(unscopables.groupBy, true, '`groupBy` property value'); | ||
verifyEnumerable(unscopables, 'groupBy'); | ||
verifyWritable(unscopables, 'groupBy'); | ||
verifyConfigurable(unscopables, 'groupBy'); | ||
|
||
assert.sameValue(unscopables.groupByToMap, true, '`groupByToMap` property value'); | ||
verifyEnumerable(unscopables, 'groupByToMap'); | ||
verifyWritable(unscopables, 'groupByToMap'); | ||
verifyConfigurable(unscopables, 'groupByToMap'); |
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
40 changes: 40 additions & 0 deletions
40
test/built-ins/ShadowRealm/WrappedFunction/throws-typeerror-on-revoked-proxy.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,40 @@ | ||
// Copyright (C) 2022 Chengzhong Wu. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-wrapped-function-exotic-objects-call-thisargument-argumentslist | ||
description: > | ||
WrappedFunctionCreate throws a TypeError the target is a revoked proxy. | ||
info: | | ||
WrappedFunctionCreate ( callerRealm: a Realm Record, Target: a function object, ) | ||
1. Let target be F.[[WrappedTargetFunction]]. | ||
2. Assert: IsCallable(target) is true. | ||
3. Let callerRealm be F.[[Realm]]. | ||
4. NOTE: Any exception objects produced after this point are associated with callerRealm. | ||
5. Let targetRealm be ? GetFunctionRealm(target). | ||
... | ||
GetFunctionRealm ( obj ) | ||
... | ||
3. If obj is a Proxy exotic object, then | ||
a. If obj.[[ProxyHandler]] is null, throw a TypeError exception. | ||
... | ||
features: [ShadowRealm] | ||
---*/ | ||
|
||
assert.sameValue( | ||
typeof ShadowRealm.prototype.evaluate, | ||
'function', | ||
'This test must fail if ShadowRealm.prototype.evaluate is not a function' | ||
); | ||
|
||
const r = new ShadowRealm(); | ||
|
||
const fn = r.evaluate(` | ||
globalThis.revocable = Proxy.revocable(() => {}, {}); | ||
globalThis.revocable.proxy; | ||
`); | ||
r.evaluate('revocable.revoke()'); | ||
assert.throws(TypeError, () => fn()); |
70 changes: 70 additions & 0 deletions
70
test/built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-wrap-throwing.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,70 @@ | ||
// Copyright (C) 2022 Chengzhong Wu. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-wrappedfunctioncreate | ||
description: > | ||
WrappedFunctionCreate throws a TypeError if the accessing target's property may throw. | ||
info: | | ||
WrappedFunctionCreate ( callerRealm: a Realm Record, Target: a function object, ) | ||
... | ||
7. Let result be CopyNameAndLength(wrapped, Target). | ||
... | ||
CopyNameAndLength ( F: a function object, Target: a function object, optional prefix: a String, optional argCount: a Number, ) | ||
... | ||
3. Let targetHasLength be ? HasOwnProperty(Target, "length"). | ||
4. If targetHasLength is true, then | ||
a. Let targetLen be ? Get(Target, "length"). | ||
... | ||
6. Let targetName be ? Get(Target, "name"). | ||
features: [ShadowRealm] | ||
---*/ | ||
|
||
assert.sameValue( | ||
typeof ShadowRealm.prototype.evaluate, | ||
'function', | ||
'This test must fail if ShadowRealm.prototype.evaluate is not a function' | ||
); | ||
|
||
const r = new ShadowRealm(); | ||
|
||
assert.throws(TypeError, () => r.evaluate(` | ||
const revocable = Proxy.revocable(() => {}, {}); | ||
revocable.revoke(); | ||
revocable.proxy; | ||
`), 'TypeError on wrapping a revoked callable proxy'); | ||
|
||
assert.throws(TypeError, () => r.evaluate(` | ||
const fn = () => {}; | ||
Object.defineProperty(fn, 'name', { | ||
get() { | ||
throw new Error(); | ||
}, | ||
}); | ||
fn; | ||
`), 'TypeError on wrapping a fn with throwing name accessor'); | ||
|
||
assert.throws(TypeError, () => r.evaluate(` | ||
const fn = () => {}; | ||
Object.defineProperty(fn, 'length', { | ||
get() { | ||
throw new Error(); | ||
}, | ||
}); | ||
fn; | ||
`), 'TypeError on wrapping a fn with throwing length accessor'); | ||
|
||
assert.throws(TypeError, () => r.evaluate(` | ||
const proxy = new Proxy(() => {}, { | ||
getOwnPropertyDescriptor(target, key) { | ||
throw new Error(); | ||
}, | ||
}); | ||
proxy; | ||
`), 'TypeError on wrapping a callable proxy with throwing getOwnPropertyDescriptor trap'); |
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
61 changes: 61 additions & 0 deletions
61
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-invalid.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,61 @@ | ||
// Copyright (C) 2022 Igalia S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.dateadd | ||
description: > | ||
RangeError thrown if an invalid ISO string (or syntactically valid ISO string | ||
that is not supported) is used as a PlainDate | ||
features: [Temporal, arrow-function] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
// invalid ISO strings: | ||
"", | ||
"invalid iso8601", | ||
"2020-01-00", | ||
"2020-01-32", | ||
"2020-02-30", | ||
"2021-02-29", | ||
"2020-00-01", | ||
"2020-13-01", | ||
"2020-01-01T", | ||
"2020-01-01T25:00:00", | ||
"2020-01-01T01:60:00", | ||
"2020-01-01T01:60:61", | ||
"2020-01-01junk", | ||
"2020-01-01T00:00:00junk", | ||
"2020-01-01T00:00:00+00:00junk", | ||
"2020-01-01T00:00:00+00:00[UTC]junk", | ||
"2020-01-01T00:00:00+00:00[UTC][u-ca=iso8601]junk", | ||
"02020-01-01", | ||
"2020-001-01", | ||
"2020-01-001", | ||
"2020-01-01T001", | ||
"2020-01-01T01:001", | ||
"2020-01-01T01:01:001", | ||
// valid, but forms not supported in Temporal: | ||
"2020-W01-1", | ||
"2020-001", | ||
"+0002020-01-01", | ||
// valid, but this calendar must not exist: | ||
"2020-01-01[u-ca=notexist]", | ||
// may be valid in other contexts, but insufficient information for PlainDate: | ||
"2020-01", | ||
"+002020-01", | ||
"01-01", | ||
"2020-W01", | ||
"P1Y", | ||
"-P12Y", | ||
// valid, but outside the supported range: | ||
"-999999-01-01", | ||
"+999999-01-01", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
for (const arg of invalidStrings) { | ||
assert.throws( | ||
RangeError, | ||
() => instance.dateAdd(arg), | ||
`"${arg}" should not be a valid ISO string for a PlainDate` | ||
); | ||
} |
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.