Commit Graph

5599 Commits

Author SHA1 Message Date
rwaldron 4847d9db5a chore: update test/**/*.js to use assert.compareArray wherever applicable 2021-09-24 12:58:15 -04:00
rwaldron d7414a8d8e chore: update src/**/*.case to use assert.compareArray wherever applicable 2021-09-24 11:21:44 -04:00
rwaldron 78554b2dac fix: update assert.compareArray.format to accept "spreadable" 2021-09-24 11:21:44 -04:00
Mike Pennisi 50dd431dff Focus test for BigInt v. of `copyWithin` method
Prior to this commit, a test for %TypedArray%.prototype.copyWithin
provided a TypedArray instance as the first argument. That argument that
is interpreted as a number, so in relying on the conversion, the test
verified behavior beyond what it purported to test.

Simplify the test by using the desired number value directly.
2021-09-24 11:21:19 -04:00
Mike Pennisi de6583d61d Use BigInt values idiomatically
Prior to this commit, a number of tests used non-BigInt values where
BigInt value are commonly used. Although this was technically
permissible to validate the behavior under test, the atypical usage
patterns tended to obscure the tests' purpose. Replace with more
appropriate values.
2021-09-24 11:20:58 -04:00
Mike Pennisi 741db35b65 Correct arguments for BigInt-accepting methods 2021-09-24 11:20:29 -04:00
Mathieu Hofman 5fee61c9e8
Add test for freezing of module namespace object (#3213)
Attempting to freeze the module namespace exotic object should not affect the `writable`-ity of the properties as that exercises the same `DefineOwnProperty` operation according to [`SetIntegrityLevel`](https://tc39.es/ecma262/#sec-setintegritylevel).

@erights discovered a [bug in v8](https://bugs.chromium.org/p/v8/issues/detail?id=12240) where, while the `Object.freeze` operation throws, it actually makes exported properties non-writable one by one.

At the request of @syg, I'm contributing a test against this behavior. The bug in v8 actually leads to a breakage of the objects invariants, however I'm not testing for that here as the root cause is the illegal freezing of the export.
2021-09-23 19:36:37 -04:00
Mike Pennisi 8fad17a506 Focus tests for `copyWithin` methods
Prior to this commit, a test for %TypedArray%.prototype.copyWithin
provided a TypedArray instance as the first argument. That argument that
is interpreted as a number, so in relying on the conversion, the test
verified behavior beyond what it purported to test.

Simplify the test by using the desired number value directly, and extend
the tests for type coercion to cover object values.
2021-09-23 15:20:34 -04:00
Mike Pennisi e6b64517a4 Correct assertion messages and improve coverage
Following a recent normative change to the Resizable ArrayBuffer
proposal [1], the term "out of bounds" no longer applies to
"length-tracking" TypedArrays whose underlying ArrayBuffer has been
resized to match their byte offset.

Reflect this in the tests by renaming the condition from "out of bounds"
to "on boundary" and by adding new assertions for true "out of bounds"
conditions.

[1] https://github.com/tc39/proposal-resizablearraybuffer/pull/70
2021-09-23 15:16:43 -04:00
Mike Pennisi 1b72bcd857 Correct mistakes in support of proposal change
Ensure that when the ArrayBuffer of a length-tracking TypedArray is
resized to the address matching the TypedArray's byte offset, the
TypedArray is *not* considered "out of bounds."
2021-09-23 15:16:15 -04:00
Leo Balter 94500e1de9
Merge pull request #3210 from tc39/rwaldron/shadowrealm-fixups
ShadowRealm: improved existing and additional coverage
2021-09-22 10:10:57 -07:00
Rick Waldron 43f4453472
Update test/built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js
Co-authored-by: Leo Balter <leonardo.balter@gmail.com>
2021-09-22 12:42:24 -04:00
rwaldron abdc0fa441 Add Proxy callable return test 2021-09-22 12:21:51 -04:00
rwaldron e4adfd8979 fix: ensure check for ShadowRealm at start of test 2021-09-22 12:21:11 -04:00
Leo Balter 49819bc0bc Add more tests verifying errors from ShadowRealms evaluation 2021-09-22 10:32:44 -04:00
Leo Balter 61bd4e9453 Add identity tests for the assert.throws 2021-09-21 16:45:27 -04:00
Frank Yung-Fong Tang 16dae73171
improve the case with the version without : (#3204) 2021-09-17 14:02:37 -04:00
Mike Pennisi 650e7add4a Improve coverage for ops involving negative zero
Prior to this commit, the modified tests used the strict equality
operator to compare computed values with negative zero. Due to the
semantics of that operator, these tests would spuriously pass if the
value under test was in fact positive zero.

Update the tests to be more precise by instead asserting equality with
the `assert.sameValue` utility method (since that method correctly
distinguishes between negative zero and positive zero).
2021-09-16 16:35:41 -04:00
Mike Pennisi 93ecde9f3a Correct typo to improve coverage
Prior to this commit, the modified test included two different
expressions in positions that were meant to describe the same
expression. This meant that the value of the intended expression was
only partially verified.

Correct the test to fully verify the value of the expression.
2021-09-16 16:34:28 -04:00
Andreas Woess 2314b99bac
Fix incorrect tests: new Date(-0).valueOf() and new Date(-1.23e-15).valueOf() should return +0. (#3201) 2021-09-15 11:57:45 -04:00
Leo Balter 227977a8e6 Fix tests issues 2021-09-14 11:58:41 -04:00
Leo Balter 6a5b818896 Add more tests to ShadowRealms
Ref #3044
2021-09-14 09:06:58 -04:00
Richard Gibson 30eca7761b Add assertion messages 2021-09-13 10:09:42 -04:00
Richard Gibson 1a655779f0 Test lastIndex overwrite with big lastIndex 2021-09-13 10:09:42 -04:00
Richard Gibson f1bad717e2 Explain the purpose of `assert` helper message parameters
The convention in some testing libraries is an explanation of what went wrong;
in this one it is an explanation of what should happen.
2021-09-13 10:09:42 -04:00
Phillip Mates ed0532e231 syntax errors for `ShadowRealm.evaluate` should be exposed 2021-09-13 10:09:42 -04:00
Mike Pennisi aa5c2adb7c Improve coverage: zonedDateTime & zonedDateTimeISO 2021-09-13 10:09:42 -04:00
Mike Pennisi 424406b5be Correct metadata 2021-09-13 10:09:42 -04:00
Mike Pennisi 57491d838f Import tests for Temporal.Now.zonedDateTimeISO
These tests originated in the Temporal proposal repository
https://github.com/tc39/proposal-temporal
2021-09-13 10:09:41 -04:00
Mike Pennisi c99ec1780d Import tests for Temporal.Now.zonedDateTime
These tests originated in the Temporal proposal repository
https://github.com/tc39/proposal-temporal
2021-09-13 10:09:41 -04:00
Mike Pennisi 0232d97415 Add tests for Temporal.Now.plainDateTimeISO 2021-09-13 10:09:41 -04:00
legendecas 7c3d29686b Add test for byteOffset coverage in %typedarray%.prototype.copywithin 2021-09-13 10:09:41 -04:00
Jan Štola 71a0bb9e7f RegExp.prototype.compile from other realm should throw TypeError from other realm. 2021-09-10 15:04:11 -04:00
André Bargull 66a3c3aa8b Add tests for Intl Enumeration API
Covers the usual surface tests and additional functionality tests which were
upstreamed from existing tests in SpiderMonkey.

Fixes #3131
2021-09-08 09:29:06 -04:00
André Bargull 71460edfeb Add helper functions to retrieve all calendars, collations, numberingSystems, and simple sanctioned units
And then use these helpers to replace hard-coded lists in other tests.
2021-09-08 09:29:06 -04:00
Mike Pennisi 4a7830beec Remove TCO tests invalidated by normative change
Normative: Define default constructors using spec steps
https://github.com/tc39/ecma262/pull/2216

Resolves https://github.com/tc39/test262/issues/2978
2021-09-07 17:51:10 -04:00
Mike Pennisi e9fc3db379 Add test for normative change to TCO&revoked Proxy
Normative: phrase tail calls as discarding resources rather than popping
execution context stack
https://github.com/tc39/ecma262/pull/2495
2021-09-07 17:50:48 -04:00
Mike Pennisi 2a898fe819 Add test for normative change to BlockStatement
Normative: continue labels should not pass through blocks
https://github.com/tc39/ecma262/pull/2482
2021-09-07 17:50:02 -04:00
Mike Pennisi b62a070221 Simplify test
Remove semantics which are not necessary to exercise the behavior under
test.
2021-09-07 17:47:06 -04:00
Mike Pennisi c4e54648c0 tools: enforce restriction on YAML
Some consumers have reported difficulty parsing an uncommon YAML
construction [1] [2] [3]. Extend the linter to help ensure that
construction is not used in future contributions.

[1] https://github.com/tc39/test262/issues/1997
[2] https://github.com/tc39/test262/pull/2505
[3] https://github.com/tc39/test262/issues/3171
2021-09-07 17:41:36 -04:00
Linus Groh 2b01f137ef Fix 'asserts.throws()' typo in two tests
This should be 'assert.throws()', otherwise these fail unexpectedly.

Fixes #3184.
2021-09-05 19:43:24 -07:00
Richard Gibson 50f3fca7a0
Test Math.hypot argument coercion (#3177)
* Test Math.hypot argument coercion

* Fix constructor
2021-09-03 15:59:25 -04:00
rwaldron 2fcc43df17 Transform legacy format to harness assertions: test/built-ins/N*/**/*.js 2021-09-02 11:34:34 -07:00
rwaldron 19d081ef1d Transform legacy format to harness assertions: test/built-ins/O*/**/*.js 2021-09-02 11:34:27 -07:00
rwaldron 2a385983b1 Transform legacy format to harness assertions: test/built-ins/P*/**/*.js 2021-09-02 11:34:18 -07:00
rwaldron 717bcbaedd Transform legacy format to harness assertions: test/built-ins/R*/**/*.js 2021-09-02 11:34:06 -07:00
André Bargull 0181293d38 "era" and "eraYear" are ECMA-402 only properties.
Both properties are only present when ECMA-402 is supported.
2021-09-02 11:23:23 -07:00
rwaldron 35ce309dc7 Transform legacy format to harness assertions: test/built-ins/F*/**/*.js 2021-09-02 11:22:11 -07:00
rwaldron 6a00f28e50 Transform legacy format to harness assertions: test/built-ins/i*/**/*.js 2021-09-02 11:22:05 -07:00
rwaldron 2944eb2eca Transform legacy format to harness assertions: test/built-ins/J*/**/*.js 2021-09-02 11:21:59 -07:00