Commit Graph

5572 Commits

Author SHA1 Message Date
Rick Waldron aea4ae2059
Transform compareArray -> assert.compareArray: test/built-ins/Proxy/**/*.js (#3235) 2021-10-05 22:42:02 -04:00
Rick Waldron c44eeadcae
Transform compareArray -> assert.compareArray: test/built-ins/RegExp/**/*.js (#3234) 2021-10-05 22:40:39 -04:00
Rick Waldron 0f47fe4528
Transform compareArray -> assert.compareArray: test/built-ins/Reflect/**/*.js (#3232) 2021-10-05 22:33:22 -04:00
Mike Pennisi 891b7915bd Remove superfluous EmptyStatement 2021-10-05 16:28:06 -04:00
Mike Pennisi 8f1fb5c257 Remove unused functions 2021-10-05 16:24:16 -04:00
Mike Pennisi a6834093aa Improve coverage by invoking functions as intended
Some tests which include function declarations designed to verify
behavior do not reference those functions. Insert the references
necessary for those functions to serve their intended purpose.
2021-10-05 16:22:56 -04:00
rwaldron addfd8bf3d fix: ensure that symbol args as message don't break assert.compareArray 2021-10-05 15:16:53 -04:00
legendecas 12e9d67bb5 Add tests for cross realms in ShadowRealm.prototype.evaluate 2021-10-04 15:39:12 -04:00
Mike Pennisi c44cee291a Assert array equivalency
The `compareArray` utility function returns a boolean value describing
whether or not the input arrays are equivalent--it does not throw an
exception when invoked with non-equivalent arrays. Prior to this commit,
however, two tests invoked `compareArray` without inspecting its return
value, so it had no impact on the result of the test.

Update the tests to fail when the "expected" and "actual" arrays are not
equivalent.
2021-10-04 15:38:08 -04:00
rwaldron 43c68163c0 Generate tests 2021-10-01 16:38:56 -04:00
rwaldron e6b47d7738 chore: update src/**/*.case to use assert.compareArray wherever applicable 2021-10-01 16:38:56 -04:00
Philip Chimento 56e537b916 Consolidate duplicate tests
There were a few tests already in the tree that overlapped ones that I
added in the previous commit. I've consolidated these and taken
information from the deleted ones where applicable, and improved on the
autogenerated assertion messages.
2021-10-01 14:30:12 -04:00
Philip Chimento 77a34cf93f Add Temporal tests
This copies over the tests that previously existed in the
tc39/proposal-temporal repository.

For context, see thread starting at:
https://github.com/tc39/test262/issues/3002#issuecomment-926234480

In service of https://github.com/tc39/test262/issues/3002
2021-10-01 14:30:12 -04:00
Rick Waldron b3158bce51
fix: corrections to assert.compareArray and assert.compareArray.format (#3226) 2021-10-01 12:52:15 -04:00
Mike Pennisi d9ddf80479 Revert "Merge pull request #3219 from tc39/rwaldron/migrate-comparearray"
This reverts commit b690cb67be, reversing
changes made to 50dd431dff. This is
necessary because the reverted changeset reduced coverage by an unknown
extent.
2021-10-01 10:18:47 -04:00
Philip Chimento c7ca06acb2
Remove duplicate tests (#3222)
While working on adding the Temporal tests from tc39/proposal-temporal I
noticed that these tests tested the same thing as each of the branding.js
tests in the same directory. This removes the duplicate tests.
2021-09-30 20:17:12 -04:00
Mathias Bynens 04ad519be9
Update RegExp property tests per Unicode v14 (#3199)
Issue: https://github.com/tc39/ecma262/issues/2514
2021-09-30 11:48:47 -04:00
Leo Balter 10ad4c1593 Split tests and fix false positive 2021-09-27 14:59:12 -04:00
Phillip Mates c768b9b8f2 Ensure that proxying wrapped functions preserves checks 2021-09-27 10:28:38 -04:00
Leo Balter b690cb67be
Merge pull request #3219 from tc39/rwaldron/migrate-comparearray
chore: convert compareArray() to assert.compareArray()
2021-09-24 12:02:11 -07:00
rwaldron a81a2a2b1f fix: ensure that assert.compareArray doesn't iterate and evaluate actual and expected more than once, unless absolutely necessary. 2021-09-24 14:26:04 -04:00
rwaldron 1feafce8ce chore: change name of argument 2021-09-24 13:59:02 -04:00
rwaldron 92dad8d640 chore: use [].map.call instead of spread 2021-09-24 13:52:37 -04:00
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