Commit Graph

149 Commits

Author SHA1 Message Date
Cam Tenny eb44f67274 asyncHelpers tests: Address code review feedback 2023-02-21 11:04:09 -08:00
Cam Tenny 1d116b48a9 harness/asyncHelpers.js: Refactor asyncTest to always return undefined instead of a Promise 2023-02-21 11:04:09 -08:00
Cam Tenny d810c684ae harness/asyncHelpers.js: Refactor assert.throwsAsync to only accept a callable 2023-02-21 11:04:09 -08:00
Cam Tenny 0294bea997 Harness tests for asyncHelpers.js' assert.throwsAsync function 2023-02-21 11:04:09 -08:00
Cam Tenny cb9b45ded2 Harness tests for asyncHelpers.js' asyncTest function 2023-02-21 11:04:09 -08:00
jugglinmike 5093c3037d
Reject exceptional input to `isConstructor` (#3748)
* Reject exceptional input to `isConstructor`

Prior to this commit, the `isConstructor` harness function would return
`false` when invoked with a value that lacked a [[Call]] internal
method. While it's true that such values are not constructors, there are
no tests which benefit from using `isConstructor` to make such an
assertion.

Extend `isConstructor` to throw an error when invoked with a
non-function object. Update a test which was misleadingly invoking the
function with the value `undefined`.

* fixup! Reject exceptional input to `isConstructor`
2022-12-15 22:53:34 -05:00
Philip Chimento 46c3823117 Temporal: Add TemporalHelpers.crossDateLineTimeZone
Several tests in staging use the Pacific/Apia IANA time zone to test the
behaviour of various algorithms for the case where Samoa skipped the
entire day of Dec. 30, 2011, when they switched from one side of the
International Date Line to the other. Since implementations are not
technically required to support IANA time zones, add a fake Samoa time
zone to TemporalHelpers that has the same transition, and use it in those
tests.

(The time zone isn't exactly the same as Pacific/Apia, since Samoa also
observes DST and this time zone doesn't. It's only the same for this one
transition.)

See: #3649
2022-10-03 12:24:00 +02:00
Philip Chimento 16ad841e7e Fix arithmetic in TemporalHelpers.oneShiftTimeZone
I made a mistake with one of the signs in one of the time zones that we
use for verifying DST handling. Luckily this didn't affect any previously
existing tests, but it affected some new tests that I'm going to add in
the next commit.

How do I know that _this_ arithmetic is correct? I feel reasonably
confident with the added test.
2022-04-04 16:24:17 -04:00
Mike Pennisi f782971ad2 Remove harness file, arrayContains.js
The `arrayContains` function has a number of deficiencies which make it
inappropriate for Test262:

- It apparently isn't very useful: despite being available for over 7
  years, fewer than ten tests use it
- It's misleading: its documentation reads, "Verify that a subArray is
  contained within an array." In reality, it only verifies that all the
  elements of one array are present in another--order does not matter.
- It's not ergonomic for test authors: it has been misused to create
  tests that were prone to false positives [1]
- It's not ergonomic for implementers: ostensibly designed for use with
  `assert`, the failure messages produced by tests that use it do not
  necessarily have very much context

All code in the "harness" directory adds to the total amount of
project-specific information which contributors are expected to to
learn. In light of the above deficiencies, the burden of this particular
harness file is unjustified.

Remove the harness file and its associated tests. Update the tests which
depend on it to express their expectations using alternate methods, and
strengthen the tests to assert element order wherever appropriate.

[1] https://github.com/tc39/test262/pull/3289
2021-11-01 12:55:10 -04:00
Mike Pennisi 7c2af2265c Remove redundancy from test for testTypedArray.js 2021-10-29 15:20:45 -04:00
rwaldron addfd8bf3d fix: ensure that symbol args as message don't break assert.compareArray 2021-10-05 15:16:53 -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
rwaldron 4847d9db5a chore: update test/**/*.js to use assert.compareArray wherever applicable 2021-09-24 12:58:15 -04:00
Leo Balter 61bd4e9453 Add identity tests for the assert.throws 2021-09-21 16:45:27 -04:00
rwaldron 488eb365db chore: migrate $ERROR -> throw new Test262Error in harness/ & test/harness 2021-07-21 15:15:55 -04:00
Rick Waldron c5e8aa9ca2 Migrate test/harness/* away from dependence on $ERROR(). Close gh-742 2020-09-16 17:37:16 -04:00
Alexey Shvayka 9e75c60028 Gracefully handle nullish arguments in harness/compareArray 2020-08-31 15:17:24 -04:00
Gus Caplan 5f99d05c6a native function validator for your consideration 2020-08-04 19:44:31 -04:00
Alexey Shvayka 96cf75770e Harness: properly format negative zero 2020-03-25 12:03:05 -04:00
Alexey Shvayka 17fc10942e Fix isWritable throwing RangeError on Array "length" 2020-03-23 14:49:12 -04:00
Leo Balter d49777de27 Whitespace cleanups. CRLF => LF 2019-10-08 20:44:09 -04:00
jugglinmike 83483b7310 Consolidate harness tests (#2374) 2019-09-27 16:24:02 -04:00
jugglinmike ce2dfd49d1 Correct bug in property helper (#2364)
Allow the property helper to be used to verify the configurability of
the global "Object" property.
2019-09-24 16:05:30 -04:00
Leo Balter 96d6bd0781
Split deepEqual tests requiring bigint (#2352) 2019-09-18 17:55:27 -03:00
Leo Balter 0fd3cf4d24
Some cleanup follow ups (#2351) 2019-09-18 14:15:53 -03:00
Ron Buckton 1056d8fde9 Add tests for regexp-match-indices (#2309)
* Add tests for regexp-match-indices

* Add tests for unicode matches based on presence of /u flag

* Added deepEqual helper, PR feedback
2019-09-18 13:39:12 -03:00
Alexey Shvayka 4edbad060e Gracefully handle errors from ToString in harness/assert (#2343)
* Introduce `assert._toString`

* Use `assert._toString` in `assert`

* Use `assert._toString` in `assert.sameValue`

* Use `assert._toString` in `assert.notSameValue`
2019-09-18 13:25:38 -03:00
Alexey Shvayka 127c896cf2 Format symbols 2019-08-24 13:35:51 +03:00
Alexey Shvayka c674362d1a Use SameValue 2019-08-24 13:24:33 +03:00
Alexey Shvayka 57f0884396 Use SameValue in verifyProperty helper (#2185) 2019-06-12 14:14:14 -04:00
Leo Balter dec4e5df74
Merge pull request #1801 from mathiasbynens/issue-1634
Move `throw "…"` for negative parsing errors to a helper function
2018-11-13 17:23:09 -05:00
Adrian Heine né Lang 0475c127c4 Fix some generators feature flags (#1933) 2018-11-07 17:51:23 -05:00
Mathias Bynens b9daa57dcb Rename to $DONOTEVALUATE per @leobalter's suggestion 2018-10-23 13:51:17 +02:00
Mathias Bynens e3feffb01e Move `throw "…"` for negative parsing errors to a helper function
Closes #1634.
2018-10-23 13:51:16 +02:00
Adrian Heine 21f6a86a6d Remove explicit sta.js includes
INTERPRETING.md states that sta.js has to be included unconditionally.
2018-10-15 12:45:55 -04:00
Mathias Bynens 75e8a317a2 Remove assert.throws.early
Negative tests are the better approach for early error tests.

Closes #1622.
2018-08-07 14:35:13 +02:00
Rick Waldron 338688bb57 testTypedArray.js: enforce order of TypedArrays 2018-04-19 15:09:39 -04:00
André Bargull ea6c18c5e2 Don't compute NaN values in functions (#1503)
`function nan() { return /* expression to compute NaN */ }` may not return the same implementation-distinguishable NaN value before and after JIT compilation.
2018-03-22 20:20:29 -04:00
André Bargull 500e48e6ce Fix various test bugs (#1502)
Fixes #1492
2018-03-22 16:36:57 -04:00
Rick Waldron 2975694f86 Weaken tests about NaN canonicalization.
Fixes gh-1476
Closes gh-1484
2018-03-13 12:53:39 -04:00
Leo Balter 2712807027
Fix errors recently introduced. (#1448)
* Fix bad references on tests for BigInt TypedArrays

* Remove bad conversions for BigInt TypedArray

* Cleanup the BigInt TypedArray harness file

Remove non used code (testBigIntTypedArrayConversions)

Move the constructors list to inside the exposed function, this prevents early implementations to fail before the function is called.

* Fix bad references in TypedArrays.of (BigInt)

* Remove BigInt tests from typedarray harness test

* Use BigInt for BigInt typedArrays

* Apply last fixings on BigInt TypedArray tests

* Apply fixes to last revision from @anba
2018-02-27 14:58:56 -05:00
Robin Templeton 9232d65b30 BigInt TypedArray tests
- add @jakobkummerow's changes
- remove EOL whitespace
- use 'Array.isArray' instead of 'instanceof Array'
- check for BigInt type in toLocaleString tests
- specify TypedArray constructor list for non-BigInt tests
- update TypedArray harness test for BigInt
- add a missing type coercion
- disable more tests for Big(U)Int64Array
- check for BigInt before using BigInt TypedArray constructors
2018-02-15 16:45:05 -05:00
Rick Waldron 89ac510488 Frontmatter: fixup "description: |" to "description: >" 2018-01-05 12:29:17 -05:00
Rick Waldron 5155397373 Add missing features 2017-12-21 16:46:57 -05:00
André Bargull 48c3240580 Add test/harness file for isConstructor.js 2017-12-21 16:46:56 -05:00
André Bargull 266e0ffb66 Remove harness/testBuiltInObject.js file 2017-12-21 16:46:56 -05:00
Leo Balter d809fd0a4f Missing features in the test/harness files (#1222) 2017-09-11 16:36:58 -04:00
Leo Balter c41faf1aca Add missing Symbol features flags 2017-09-07 15:51:13 -04:00
Rick Waldron 4ea2931f16 Update all harness files to pass linting. (#1153)
```
$ python tools/lint/lint.py --whitelist lint.whitelist harness/*.js
Linting 25 files.
Linting complete. 0 errors found.
```

- Renames detachArrayBuffer-$262.detachArrayBuffer.js -> detachArrayBuffer-host-detachArrayBuffer.js (previous naming prevents command-click from terminal)

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-07-14 11:37:24 -04:00