Commit Graph

355 Commits

Author SHA1 Message Date
Rick Waldron e4883091b9 Introduce $262.agent.safeBroadcast and migrate Atomics tests.
Migrating all tests to this API is necessary to prevent tests from hanging indefinitely when a SAB is sent to a worker but the code in the worker attempts to create a non-sharable TypedArray (something that is not Int32Array or BigInt64Array). When that scenario occurs, an exception is thrown and the agent worker can no longer communicate with any other threads that control the SAB. If the main thread happens to be spinning in the $262.agent.waitUntil() while loop, it will never meet its termination condition and the test will hang indefinitely.

Because we've defined $262.agent.broadcast(SAB) in https://github.com/tc39/test262/blob/master/INTERPRETING.md, there are host implementations that assume compatibility, which must be maintained.
2018-11-20 15:17:47 -05: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
Ms2ger 4986474fd1 Intl: Add an overlong language to getInvalidLocaleArguments(). 2018-10-26 16:48:40 -04:00
Rick Waldron ee3715ee56 Improve assertion handling when comparison causes failure via coercion 2018-10-23 17:25:58 -04:00
Rick Waldron f247a5fe09 Revert "Improve assertion handling when comparison causes failure via coercion"
This reverts commit c49c356744.
2018-10-23 17:21:17 -04:00
Rick Waldron c49c356744 Improve assertion handling when comparison causes failure via coercion 2018-10-23 17:00:47 -04: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
André Bargull d7d154b3bc Remove requirement that ToNumber(value) completes in less than $262.agent.MAX_TIME_EPSILON
$262.agent.MAX_TIME_EPSILON was intended to be used for callers like `Atomics.wait(typedArray, indexNumber, valueNumber, timeoutNumber)` where all parameters with the `Number` suffix denote values which are already Number values. It should not be used for `Atomics.wait(typedArray, indexObject, valueObject, timeoutObject)` where all parameters with the `Object` suffix denote values which are Object values, because in that case we'd require that `ToNumber(objectValue)` (potentially invoked multiple times) completes in less than 100 milliseconds (the default value for MAX_TIME_EPSILON).

Also removes $262.agent.MAX_TIME_EPSILON because it is now no longer used.
2018-08-19 10:29:29 -04:00
André Bargull 8879820a8f Make RegExp/CharacterClassEscapes tests faster across all engines 2018-08-17 07:48:42 -07: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 4314e2cab3 Make doneprinthandle.js accept the input and produce the output expected by test262-harness. (#1650)
This is not a breaking change, it simply adds explicit handling to the function
2018-07-25 17:06:52 -07:00
Leo Balter afe2647d19 Add harness files to the renaming party 2018-07-24 15:03:54 -04:00
André Bargull 8bc4e38a48 Make Atomics tests more resilient against intermittent failures (#1617)
Also fixes multiple issues and bugs in various Atomics tests.

CONTRIBUTING.md and INTERPRETING.md:
- Add missing description for `CanBlockIsFalse` flag and also introduce `CanBlockIsTrue` flag which is needed for some tests (see below).

harness/atomicsHelper.js:
- Updated `$262.agent.waitUntil` to clarify it can also be called with BigInt64Array objects.
- Added `$262.agent.timeouts` constants to unify the various, inconsistently used timeouts in the Atomics tests. Each timeout constant has a brief description and a usage example to clarify when it should or should not be used. The default values were tested in SpiderMonkey (locally and CI) under various system load levels and should hopefully also be valid for other engines. 
- Added `$262.agent.tryYield` to yield control from the main thread. The default implementation simply calls `$262.agent.sleep`, but test262 hosts could theoretically provide a different implementation.
- Added `$262.agent.trySleep` to replace direct calls to `$262.agent.sleep` from the main thread. Motivation for this function: Some test262 hosts (like browsers) may be able to pause and sleep on the main thread, so they could provide their implementation for `trySleep` which performs a busy-wait or something do nothing.

harness/testAtomics.js:
- Replace `let`, `arrow-functions`, and `for-of` loops to avoid creating extremely long `features` lists in tests using this helper. Removed `Map`, `WeakMap`, `Set`, and `WeakSet` (these weren't even listed in features.yaml) for the same reason and added the missing `Symbol` entry for this file to features.yaml.
- Updated all files including "harness/testAtomics.js" to match the new feature requirements.


test/built-ins/Atomics/store/good-views.js and test/built-ins/Atomics/store/bigint/good-views.js:
- Replace `arrow-functions` and `for-of` loops with ES5 alternatives.


test/built-ins/Atomics/wait/bigint/*.js and test/built-ins/Atomics/wake/bigint/*.js
- Some tests were using `BigInt64Array.BYTES_PER_ELEMENT * 8` for the SharedArrayBuffer length, but their non-BigInt counterparts are using `Int32Array.BYTES_PER_ELEMENT * 4`. For consistency and to make it easier to compare the BigInt against the non-BigInt versions, I've changed it to `BigInt64Array.BYTES_PER_ELEMENT * 4`.
- Also aligned formatting and statement placement when they differed between the non-BigInt and the BigInt version of a test file. (I've diffed some of the non-BigInt and BigInt files against each other and different formatting was a nuisance.)

Test files using `$262.agent.monotonicNow()`:
- Moved `$262.agent.report()` calls outside of the block of code measured `$262.agent.monotonicNow()` to avoid measuring how long it takes to execute `$262.agent.report()`. 
- Without this change some tests failed intermittently in certain test configurations in SpiderMonkey. For example with the flags `--ion-eager -- ion-offthread-compile=off` which forces early Ion compilation on the main thread. The `$262.agent.report()` implementation in the SpiderMonkey test262 host embedding uses a for-loop which was forcefully Ion compiled under these settings. And because Ion compilation can take some time, the test case ran longer than `$262.agent.MAX_TIME_EPSILON` which lead to intermittent failures.

Test files using `CanBlockIsFalse` / `CanBlockIsTrue`:
- Some of these tests actually expected that the main thread can wait and [[CanBlock]] is `true` for the agent record executing the test. Therefore I've added a new `CanBlockIsTrue` flag and replaced the flags where needed.

test/built-ins/Atomics/wait/**/*.js and test/built-ins/Atomics/wake/**/*.js:
- Use an atomic counter `RUNNING` in more tests to have better control when a worker agent was actually started.
- Replace the various `$262.agent.sleep(/* Sleep X ms to ensure worker actually sleeps */)` calls with the new `$262.agent.tryYield()` function. This `X` was sometimes as low as 10 milliseconds, which is definitely too short for CI systems under heavy load (observed by intermittent CI failures for SpiderMonkey) and sometimes as high as 500 milliseconds, which is probably much longer than needed even when the system is under heavy load. 
- Removed duplicate strings in assertion messages, presumably from copy-pasting the messages between different files.
- Removed extra empty lines at the end of multiple files.

test/built-ins/Atomics/wake/bad-range.js, test/built-ins/Atomics/wake/bigint/bad-range.js, and test/built-ins/Atomics/wait/bigint/non-bigint64-typedarray-throws.js:
- Removed unnecessary `features` and `includes` from this file.

test/built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo.js and test/built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js:
- The test was actually broken and didn't test what it said it does. This probably explains #1530.
- The test wants to ensure the waiterlist is implemented as a FIFO structure. This requires that the waiting agents all wait on the same index position, because the waiterlists are defined by each index. But if the agents wait on different indices, each agent is inserted into a different FIFO structure and therefore we can't observe any FIFO ordering between the agents when they're woken up.
- All this requires a bit of synchronization between the main agent and the waiting agent, I hope the added comments help to review these changes.

test/built-ins/Atomics/wait/good-views.js:
- The agent sends multiple reports to the main agent, but only the first one was read.
- This error was introduced during previous refactorings. I've changed it to back to use a while-loop as used in the first version of this file.

test/built-ins/Atomics/wait/no-spurious-wakeup-no-operation.js:
- Only the BigInt version of this test was present, copied it so we also get code coverage for the non-BigInt case.

test/built-ins/Atomics/wait/waiterlist-block-indexedposition-wake.js:
- Added extra while loops to avoid intermittent failures when the agent worker haven't started to wait.
- This should help to avoid some of the intermittent failures we saw for SpiderMonkey.

test/built-ins/Atomics/wake/wake-all-on-loc.js and test/built-ins/Atomics/wake/bigint/wake-all-on-loc.js:
- This test was also no longer after previous refactoring sessions.
- The "B" agent only waited for 10 milliseconds, which made it likely that it already timed out before the main agent was able to call `Atomics.wake`, which in turn rendered the test useless, because the test case wants to ensure that `Atomics.wake` cannot wake "B". But if "B" was already timed out, it can trivially not be woken by `Atomics.wake`.
- Added some safety measure to catch the case when "B" timed out before `Atomics.wake` was called and made it a test error if that happens.

test/built-ins/Atomics/wake/count-defaults-to-infinity-missing.js, test/built-ins/Atomics/wake/count-defaults-to-infinity-undefined.js, and test/built-ins/Atomics/wake/undefined-index-defaults-to-zero.js:
- Changed the `$262.agent.start()` calls to use a for-loop to avoid code duplication.
- (Forgot to undo the code formatting around `assert.sameValue`, still need to change it back.)
- Also more while-loops around `Atomics.wake`.
- These changes should fix #1529 and #1566.

test/built-ins/Atomics/wake/wake-all.js:
- Removed "B" worker agent.
- Without this removal the test case would be exactly equal to test/built-ins/Atomics/wake/wake-all-on-loc.js.

test/built-ins/Atomics/wake/wake-in-order-one-time.js:
- Add for-loops to avoid code duplication and make the test more readable.
- Make the `Atomics.wake` assertion messages unique by adding the current loop counter.
- Add `$262.agent.tryYield()` to give the worker agents enough time to actually start waiting.

test/built-ins/Atomics/wake/wake-in-order.js:
- Removed the outer loop `attempt < 10` because it uses `$262.agent` in a way currently not required to work. And which actually also doesn't work in SpiderMonkey's implementation of `$262.agent`.
- According to INTERPRETING.md `$262.agent.broadcast()` broadcasts its message to all agents ever started by `$262.agent.start()` and then blocks until all agents received the broadcast. It is not required that the agents started by the first `$262.agent.broadcast()` call will all be disabled/destroyed/whatever when the second `$262.agent.broadcast()` call occurs, which then means the second `$262.agent.broadcast()` call still tries to reach the agents started in the first loop iteration, but these may no longer accept broadcasts and therefore won't acknowledge they've received the broadcast. Which then means the second `$262.agent.broadcast()` call waits forever.
2018-07-03 12:34:54 -04:00
Leo Balter 56091a0c5f
Merge pull request #1533 from rwaldron/1527
Atomics: various corrections, nit-picking and BigInt variants
2018-06-27 13:49:18 -04:00
Rick Waldron c29ae8effb Atomics: refactor atomicsHelper.js to extend $262.agent.* 2018-06-27 11:13:23 -04:00
Rick Waldron be21156542 Atomics: simplify harness/atomicsHelper.js: waitUntil 2018-06-27 10:30:46 -04:00
Rick Waldron d9084b98e7 Atomics: fix documentation in atomicsHelper.js 2018-06-26 14:53:49 -04:00
Ms2ger b4efa8c938 Add tests for the shape of the Intl.RelativeTimeFormat API. (#1596)
* Add Intl.RelativeTimeFormat feature.

* Add tests for the shape of the Intl.RelativeTimeFormat API.

* fixup! Add tests for the shape of the Intl.RelativeTimeFormat API.
2018-06-26 14:02:29 -04:00
Rick Waldron 73be21272d Atomics: wake/wake-in-order.js, capture waiterlist order for wake comparison 2018-06-25 17:02:40 -04:00
jugglinmike 330733eaf3 Correct licensing (#1608)
In order to satisfy the project's formatting rules, license information
was inserted into a number of files where it had been mistakenly omitted
by the original contributors [1]. In many cases, the license information
did not accurately describe the contributor or the time of contribution.
Update the information according to the information provided by the
contributors at the time each file was authored:

- atomicsHelper.js - a72ee6d912
- detachArrayBuffer.js - 70c7375be8
- nans.js - b17ffc0298
- nativeFunctionMatcher.js - 6b7cbb5035
- proxyTrapsHelper.js d530c87b41
- regexpUtils.js - 44b40e083e
- tcoHelper.js - 4dc81d3788

[1] 4ea2931f16
2018-06-25 10:30:11 -04:00
Rick Waldron 84f448f060 Atomics: fix buffer sizes 2018-06-22 16:35:15 -04:00
Rick Waldron 7f3a1c1be9 Atomics: moves getReport and waitUntil into atomicsHelper.js; broad updates to all Atomics.wait tests 2018-06-22 15:14:11 -04:00
Rick Waldron 253bc87bc5
Merge pull request #1560 from tc39/intl-update-iana-subtags-2018-04-23
Intl: Update language subtag data to "IANA language subtag registry, file date 2018-04-23"
2018-06-04 16:22:01 -04:00
Ms2ger 501a9a674f Various additions to the Intl.Locale test coverage. 2018-06-04 14:08:28 +02:00
Mike Pennisi 51bbcf59be Formalize asynchronous failure conditions
Previously, the error message generated by failed asynchronous tests was
generic and underspecified. Improve the format and explicitly document
it in project's interpreting guidelines.
2018-05-20 15:24:55 -04:00
Rick Waldron 560d9e519c Intl: Update language subtag data to "IANA language subtag registry, file date 2018-04-23"
https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2018-05-18 11:54:44 -04:00
Ms2ger 190cf5c730 Extract list of structurally invalid tags from invalid-tags.js. 2018-05-03 14:20:39 -04:00
Rick Waldron c55d2ab7c3 Extensive Function toString updates for "Function.prototype.toString revision" proposal. (#1510)
Fixes gh-1453
2018-04-19 16:44:52 -04:00
Rick Waldron ac65ecab7c Atomics: updates to tests 2018-04-19 15:09:39 -04:00
peterwmwong f1e45d9e5e
Fleshed out tests for Symbol.matchAll, String.p.matchAll, RegExp.p[@@matchAll], and %RegExpStringIteratorPrototype%
Tests were updated and assuming https://github.com/tc39/proposal-string-matchall/pull/33 will be merged.
2018-03-17 22:48:31 -05: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 222b86cac5
improve propertyHelper for failure messages (#1480)
Example:
Before: descriptor value should be 42 Expected SameValue(«1», «0») to be true
After: descriptor value should be 42
2018-03-08 12:12:15 -05:00
Michael Ficarra 83ffb4bbf2 allow any function to report its toString as a NativeFunction
related: https://github.com/tc39/Function-prototype-toString-revision/pull/26
2018-03-07 14:09:45 -05:00
Rick Waldron 4efdb83ae9 Updates a portion of the BigInt tests that need work. Ref gh-1461 (#1462) 2018-02-27 17:45:25 -05: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
Leo Balter c6cd535940 Last cases of convertToBigInt 2018-02-15 16:45:10 -05:00
Leo Balter 098c69540e Remove N() 2018-02-15 16:45:08 -05:00
Leo Balter 3f3f2faa8e whitespace 2018-02-15 16:45:08 -05:00
Leo Balter c1bc43b1b1 Restore original tests for TypedArrays and optimize files
- optimize file names
- BigInt folder for TAs.from and of
- copy tests preparing for bigint
- copy ta prototype methods for bigint
- Use an exclusive harness for bigint typedarrays
- add features
- use proper harness
- use preper harness
- Restore original tests for TypedArrays
- final fixes
- fix includes
2018-02-15 16:45:06 -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
André Bargull 40a7bd2401 Add test cases for tc39/ecma402#194 2018-01-25 14:04:44 -05:00
André Bargull 266e0ffb66 Remove harness/testBuiltInObject.js file 2017-12-21 16:46:56 -05:00
André Bargull 60692bb6e0 Move remaining testBuiltInObject callers to use normal assert calls 2017-12-21 16:46:56 -05:00
André Bargull c81370348d No longer use testBuiltInObject for built-in objects 2017-12-21 16:46:56 -05:00
André Bargull ecf814bb4c No longer use testBuiltInObject for built-in constructors 2017-12-21 16:46:56 -05:00
André Bargull 4337b396bd Add separate test files for property attributes of Intl properties 2017-12-21 16:46:56 -05:00
André Bargull 513a3056fb Add separate test files to test the length property of Intl functions 2017-12-21 16:46:56 -05:00
André Bargull 72db5f1ec1 Replace mustHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull ce3c3d7dbd Replace mustNotHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull 20ea611db7 Replace mayHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull d249979bc9 Update language tag mapping data 2017-12-21 16:46:55 -05:00
André Bargull 2bf5a3ce26 Add numbering system digits for 'bali' and 'limb' 2017-12-21 16:46:55 -05:00
André Bargull 2efacfe368 Update list of numbering systems to match CLDR 32 2017-12-21 16:46:55 -05:00
André Bargull 56323fe2dd Also test Intl.PluralRules if available 2017-12-21 16:46:55 -05:00
André Bargull 48173672f2 Inline testValidDateTimeComponentValue into single test using this function 2017-12-21 16:46:55 -05:00
André Bargull 064ce66a5b Remove unused return value for testOption 2017-12-21 16:46:55 -05:00
André Bargull 52980ef496 Move test data for getLocaleSupportInfo into getLocaleSupportInfo 2017-12-21 16:46:55 -05:00
André Bargull 017fa6d55f Remove caching of getLocaleSupportInfo() return value 2017-12-21 16:46:55 -05:00
André Bargull 123259733b Replace testArraysAreSame with assert.compareArray 2017-12-21 16:46:55 -05:00
André Bargull e65c65c293 Remove unused return value from testWithIntlConstructors 2017-12-21 16:46:55 -05:00
André Bargull f87aeab893 Canada/East-Saskatchewan is no longer a valid time zone identifier (tzdata2017c) 2017-12-21 16:46:55 -05:00
Aakash Patel 4fdbb34914 Remove unnecessary uses of let in harness.
The use of `let` is unnecessary here, particularly in a
file that is needed to run any of the tests, even the ES5 tests.
Removing it allows older engines to run older tests.
2017-12-19 15:50:19 -05:00
Robin Templeton cca3876881 getBigInt64 2017-10-24 11:48:34 -04:00
Leo Balter 9737a5ff73 Improve tests for BigInt.prototype.valueOf (#1256)
* Improve tests for BigInt.prototype.valueOf

* fixup! Improve tests for BigInt.prototype.valueOf

* fixup! Improve tests for BigInt.prototype.valueOf

* fixup! Improve tests for BigInt.prototype.valueOf
2017-10-03 16:51:07 -04:00
Yusuke Suzuki ba891c753c Do not use BigInt literal without `features: [BigInt]` (#1253)
typeCoercion.js is included in several tests which are not marked as `features: [BigInt]`.
Since BigInt is new feature, we should not make the above unrelated tests failed due to
lack of BigInt syntax support.

Close #1252.
2017-10-03 14:22:03 -04:00
Robin Templeton 5f338a30a1 Add tests for BigInt.prototype.valueOf (#1234)
* BigInt valueOf tests

* add features from typeCoercion.js
2017-10-02 16:13:09 -04:00
Josh Wolfe dafde72971 BigInt.asUintN tests
* typeCoercion.js supports ToIndex
* typeCoercion.js supports ToBigInt
* updated BigInt.asIntN type coercion tests to use typeCoercion.js
2017-09-12 18:38:29 -07:00
Rick Waldron 8a2ec34200 harness/*: Eliminate unnecessary uses of features that would require "features: ..." tags 2017-09-08 12:25:44 -04:00
Rick Waldron 65424be3ef Lint: harness features flag enforcement via linter 2017-09-08 12:24:48 -04:00
Josh Wolfe f83adad4bd test for String.prototype.indexOf first parameter type coercion 2017-09-08 10:15:19 -04:00
Josh Wolfe 0d9ef34510 more separation of ToInteger from ToNumber 2017-09-08 10:15:19 -04:00
Josh Wolfe 0f3f22f6ab use informative stack traces instead of loops 2017-09-08 10:15:19 -04:00
Josh Wolfe 29938e9525 type coercion harness utilities 2017-09-08 10:15:19 -04:00
Leo Balter 74cfdfcca3 Remove arrow function syntax from harness/assert.js
After conversations in #1215, we need to catch up with the code that was previously
produced before we set the features flags requirements.
2017-09-08 10:13:23 -04:00
Rick Waldron c23ea89fe2 Fix indentation in harness/propertHelper.js 2017-08-31 14:05:46 -04:00
Doug Ilijev c0b520b8c9 Remove harness/simdUtilities.js because SIMD tests were removed and nothing references it. (#1162) 2017-08-03 17:46:14 -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
Rick Waldron 30a4fb13a2 Fix typo in harness/arrayContains.js
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:59 -04:00
Rick Waldron 27f3452b33 harness test: arrayContains.js
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:59 -04:00
Rick Waldron c9f3ab5610 Temp renaming to get around case ignorance, part 2
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:59 -04:00
Rick Waldron 86209d8fd9 Make all harness/* file names consistent; update occurrences in test
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:58 -04:00
Rick Waldron 2086f66c55 Update verifyProperty to allow checking `value`
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-23 11:58:16 -04:00
Leo Balter 666f0e920a
Add assert.throws.early 2017-05-01 12:29:52 -04:00
Daniel Ehrenberg abac4e0b19
Fix up compareArray 2017-04-27 19:33:41 -04:00
Daniel Ehrenberg 8cb7f59395
Create an assert.compareArray
This is a convenience function which tries to make tests easier
to read and write.
2017-04-27 19:33:40 -04:00
André Bargull 94f6003d11 Optimize decodeURI/encodeURI tests (#987)
* Move decimalToHexString into harness instead of duplicating it in multiple files

* Optimize decimalToHexString and support numbers greater than 65535

* Replace alternative decimalToHexString function with include for decimalToHexString.js

* Add decimalToHex2String to return the string representation of a two-digit hex-number

* Replace decimalToHex2String with decimalToPercentHexString to return the percent hex-encoded string of a two-digit hex-number

* Replace two String.fromCharCode calls with a single call

* Further reduce string concatentations in decodeURI[Component] tests

* Remove unnecessary Test262Error error handling in catch-clauses

* Remove try/catch wrappings in decodeURI/encodeURI tests
2017-04-18 16:31:31 -04:00
Leo Balter e43ce56105 Add Verify Property harness (#979) 2017-04-15 12:56:29 -04:00
André Bargull 1ba3a7c4a9 Remove unused functionality from harness (#975) 2017-04-14 12:22:27 -04:00
André Bargull d59e30c95e Remove execute bit from files (#976) 2017-04-13 16:24:07 -04:00
Mathias Bynens 44b40e083e Add exhaustive tests for RegExp Unicode property escapes (#971)
Proposal: https://github.com/tc39/proposal-regexp-unicode-property-escapes

These tests have been generated by the script at https://github.com/mathiasbynens/unicode-property-escapes-tests. They check all the properties and values that should be supported by implementations against the symbols they’re supposed to match. False positives are detected as well.

Ref. #950.
Ref. https://github.com/tc39/proposal-regexp-unicode-property-escapes/issues/4.
2017-04-13 11:22:49 -04:00
Mathias Bynens a621155bcd Unify indentation and add .editorconfig (#973) 2017-04-13 10:37:32 -04:00
Leo Balter 866d7f8d8e Improve isEnumerable check with a for-in loop for string names (#880)
Ref https://github.com/tc39/test262/pull/879#discussion_r104128520
2017-03-13 10:48:33 -07:00
Lars T Hansen abc4dfae42 Account for the use of ToIndex in Atomic operations (#870)
Ref tc39/ecma262#807
2017-03-02 13:21:14 -05:00
Rick Waldron fdd2fa9b1c Rename $ => $262. Fixes gh-802 (#823)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-03-01 16:34:15 -05:00
Shu-yu Guo a72ee6d912 SharedArrayBuffer and Atomics tests (#839) 2017-02-07 11:17:31 -05:00
Kevin Gibbons abf6489b29 use $.detachArrayBuffer API instead of throwing (#795) 2016-11-22 17:13:23 -05:00
Mike Pennisi ade6d2e384 Remove "NotEarlyError" object
Because expectations regarding error "phase" are now expressed via test
meta-data, the test runner may now enforce this requirement on negative
tests.

Remove the "NotEarlyError" from the project source. This reduces the
amount of domain knowledge required to author tests and lessens the
potential for inconsistencies between tests.
2016-10-19 15:24:22 -04:00
Leonardo Balter 813bb5166c
Remove precision-equivalency tests
Due to specs approximation values, some tests are invalid as the harness
helpers rely on another approximated values as Math.LN2.
2016-06-20 17:44:11 -04:00
Leonardo Balter bc42c6ab5c Add harness for byte conversion values
Update testTypedArrayConversions to require byteConversionValues
2016-05-25 10:10:50 -04:00
jugglinmike b17ffc0298 Add tests for NaN handling with Typed Arrays (#623)
Ensure that NaN values are canonicalized consistently by all invocations
of SetValueInBuffer. Also ensure that `%TypedArray%.prototype.set` and
`%TypedArray%.prototype.slice` preserve the bit-level encoding of the
source data.

Use a set of experimentally-derived expressions known to produce NaN
values with distinct bit patterns in various platforms.
2016-05-12 10:16:03 -04:00
Gorkem Yakin f6475d81bf Merge pull request #543 from bocoup/enumerable-helper
Fix verifyEnumerable helper to account for properties with Symbol values
2016-04-25 16:32:53 -07:00
jugglinmike ba3dacbe5a Correct tests for native functions' toString value (#580)
Modify the regular expression for native functions' toString value to
satisfy all test cases. Correct the test file's reference to the harness
file. Re-format the test file's assertions to aid debugging in the event
of failure.
2016-04-21 15:55:54 -04:00
jugglinmike cf68c3be91 Correct invalid tests for the Date constructor
The millisecond representation of a given Date instance is dependent on
the local system's time zone settings. In order to pass consistently
across contexts, tests for this value must take the system configuration
into account.

Introduce a test harness utility function to encapsulate these concerns.
Re-use this function across all test files that assert the exact
millisecond representation of Date instances.
2016-04-19 17:00:59 -04:00
Leonardo Balter 04a3c28f7d Add tests for conversion operations on TypedArrays 2016-04-19 12:18:52 -04:00
dtig 20d37a6f2f Add SIMD test suite and utility functions (#442) 2016-04-18 14:26:15 -04:00
Leonardo Balter e7f6cd7f86 assert.throws fails if second argument is not a function 2016-04-15 10:14:54 -04:00
Michael Ficarra 6b7cbb5035 add Function.prototype.toString tests, conforming to proposed revision
See the proposal at
https://tc39.github.io/Function-prototype-toString-revision/
2016-04-11 14:39:12 -04:00
Leonardo Balter 70c7375be8 Add harness/detachArrayBuffer.js 2016-03-22 17:00:01 -04:00
Leonardo Balter a93ef42b56 Fix verifyEnumerable helper to account for Symbol properties 2016-03-15 10:13:52 -04:00
Jordan Harband a6fad62d7c Last minute fixes 2016-02-19 11:27:31 -08:00
Jordan Harband 6f05b008dc Encapsulate helper function's helper function 2016-02-17 15:01:26 -08:00
Jordan Harband d530c87b41 Create `proxyTrapsHelper` to throw on all traps by default. 2016-02-13 15:56:47 -08:00
Gorkem Yakin dbcc8cadf3 Merge pull request #507 from bocoup/remove-unused-file
Remove unused harness file
2016-02-12 17:16:01 -08:00
Leonardo Balter 4388f2869c Allow call testWithTypedArrayConstructors with a constructors subset 2016-02-12 16:02:36 -08:00
Mike Pennisi 071b5f03c6 Remove unused harness file
The harness file `Test262Error.js` has not contained executable code since it
was introduced in this project [1]. The definition of the `Test262Error`
function has consistently been located in the `sta.js` harness file which test
runners are expected to inject into the test environment.

Remove the file and all references to it.

[1] See commit c33bf0e043
2016-02-12 13:44:18 -05:00
Mike Pennisi 4dc81d3788 Add tests for tail-call optimization
ECMAScript 2015 introduced tail call optimization for function calls
occuring in a number of positions in the grammar. Assert expected
behavior by triggering a large (but configurable) number of recursive
function calls in these positions. Compliant runtimes will execute such
programs without error; non-compliant runtimes are expected to fail
these tests by throwing an error or crashing when system resources are
exhausted.
2016-02-01 13:20:17 -05:00
André Bargull 42edfd6e89 Add missing tests for "length" and "name" properties of %TypedArray% built-in functions 2016-01-15 18:12:42 +01:00
André Bargull b62dccf1dc Add test cases for recent ES2016 fixes
- lastIndex in RegExp.prototype[Symbol.split]: tc39/ecma262@08b4756747
- Missing number conversion in DataView.prototype.setXXX: tc39/ecma262@4f875fe96d
- Negative zero byteoffset in TypedArray: tc39/ecma262@2d1ed20db7
- EvalDeclarationInstantiation throws TypeError: tc39/ecma262@2be6968715
- BindingRestElement allows BindingPattern: tc39/ecma262@d322357e6b
- Eval in parameters with computed property keys: tc39/ecma262@04e2e9b719
- Use strict with non-simple parameters: tc39/ecma262@15b0db41ed
- __proto__ in strict mode: tc39/ecma262@5c1984334d
2015-12-15 17:33:49 +01:00
André Bargull 9a3f810465 Remove harness/runTestCase.js 2015-08-13 18:13:45 +02:00
Leonardo Balter e1ec3c29b3 Fix missing variable declaration
Fixes #405
2015-08-05 20:04:02 -04:00
Brian Terlson 8870e7bf34 Merge pull request #394 from smikes/quoted-sameValue-strings
Use guillemets («») to quote string values - fixes #174
2015-08-05 11:20:18 -07:00
smikes 4a6f28f075 Use guillemets («») to quote string values - fixes #174
Expected/actual values should be delimited in a way that
isn't confusable with actual string quotes " '
2015-07-30 20:13:49 -06:00
Brian Terlson eea8807d40 Merge pull request #355 from anba/regexp-unicode
B.1.4 and Unicode RegExps
2015-07-30 15:31:16 -07:00
André Bargull a85f5039e0 Remove links to hg.ecmascript.org 2015-07-17 17:43:09 +02:00
André Bargull d5075819e9 Check resolved time zone is valid 2015-07-08 19:13:55 +02:00
André Bargull a4205bac61 B.1.4 extensions are not allowed for Unicode RegExps 2015-07-08 17:19:59 +02:00
Brian Terlson 20d39432b9 Merge pull request #337 from bocoup/remove-fn-exists
Remove unnecessary "include" file
2015-06-26 11:02:45 -07:00
Brian Terlson 9abed155e3 Merge pull request #338 from bocoup/move-web-scripts
Move web scripts
2015-06-26 10:58:59 -07:00
Brian Terlson 9dc49b72cc Merge pull request #336 from bocoup/remove-env
Remove empty "include" file
2015-06-26 10:57:59 -07:00
Mike Pennisi b974c13751 Move website scripts to a dedicated directory
Some JavaScript source files are only relevant in the context of the
Test262 website. They should not be explicitly included by individual
tests, so their presence in the `harness/` directory alongside "include"
files is misleading.

Move the scripts to a location within the `website/` directory to
better-reflect their intended use. Update the relevant HTML templates
with the new locations.
2015-06-26 13:29:07 -04:00
Mike Pennisi 86c7e272a6 Remove support for legacy `$INCLUDE` syntax
Although test files once expressed dependencies on external files using
a global `$INCLUDE` function, that pattern was removed in favor of
declarative meta-data [1].

Remove the associated logic from the Python runner and the browser.

[1] See commit d4354d14d5.
2015-06-26 13:29:07 -04:00
Mike Pennisi f8e18ccd76 Remove unnecessary "include" file
The `fnExists` function defines a generic way to determine if any number
of values are function instances. Because it is only used by a single
test, the additional complexity required by the generalized code (and
the organizational drawbacks to maintaining another "include" file) are
not justified. Remove the file and update the test to assert the
function's existence directly.
2015-06-26 12:34:04 -04:00
Mike Pennisi e57da7a8f1 Remove empty "include" file
The `environment.js` file has been empty since its initial introduction
to this project [1]. It has no effect on any of the contexts in which it
is currently referenced, so it may be safely removed.

[1] be82787a00
2015-06-26 12:19:51 -04:00
Brian Terlson e4a25da86a Merge pull request #305 from jugglinmike/browser-only-strict
Update browser runner to honor `onlyStrict` flag
2015-06-25 14:44:34 -07:00
Erik Arvidsson 96e5b67cd5 Fix issue with math_precision.js
It was missing vars which was causing issues with our test harness
since we run all the files in strict mode.
2015-06-25 16:43:10 -04:00
Mike Pennisi cb617493d7 Update browser runner to honor `onlyStrict` flag
Unlike the console runner, the browser runner does not modify the
strictness of tests prior to running them. Regardless of a given test's
metadata, it runs every test exactly once, and it never enables strict
mode. This means that tests intended to function in strict mode must
declare the "use strict"; directive prologue in addition to the
`onlyStrict` flag.

For any test that specifies the `onlyStrict` metadata flag, transform
the source code by injecting a "use strict" directive prologue prior to
running the test.
2015-06-18 17:38:33 -04:00
Mike Pennisi 73aa06275a Update browser runner to inject `assert.js`
Since the Python runner was updated to include `assert.js` in all tests
unconditionally, a number of tests have been written that implicitly
rely on its presence. The browser runner does not currently provide this
file's contents to these tests, so they fail unconditionally.

Update the browser runner to inject that file's contents into every test
context.

Note: the existing approach to file retrieval (namely loading via
synchronous XHR requests) is inefficient and deprecated in some
browsers. It is honored here for the sake of consistency and to minimize
the changeset necessary to fix the browser runner.
2015-06-18 13:53:09 -04:00
Mike Pennisi fe11a1ea1a Remove $PRINT helper function
The `$PRINT` helper function has no effect on test behavior. The
following tests use it to report assertion outcomes (and as a result
will fail silently):

- test/language/function-code/S10.2.1_A4_T2.js
- test/language/function-code/S10.2.1_A5.1_T1.js
- test/language/function-code/S10.2.1_A5.1_T2.js
- test/language/function-code/S10.2.1_A5.2_T1.js

Remove the function definition and all references within tests. Update
tests that use it as an error reporting mechanism to instead use an
appropriate `assert` helper function.
2015-06-16 13:43:23 -04:00
Mike Pennisi 92890e6723 Remove `$FAIL` function
This function is equivalent to `$ERROR` (which is automatically included
in test environments). Remove the harness file that defines the
function, remove references to the file from test `includes` lists, and
update scripts to instead invoke the `$ERROR` function.
2015-06-09 19:44:25 -04:00
André Bargull 56036e4064 Enable strict mode for more built-in tests
- Remove no longer needed noStrict flags.
- Change tests to use propertyHelper.js for strict mode compatibility.
- Add tests for return value of `delete` operator, e.g. `delete Array.prototype === false`.
- Add non-writable tests for global NaN property.
- Split some tests to run in strict mode.
- Change tests with global `var length` declaration to use a different variable name for browser environments.
- Merge duplicated tests symbol-data-property-configurable-non-strict and symbol-data-property-configurable-strict.
- Merge duplicated tests symbol-data-property-writable-non-strict and symbol-data-property-writable-strict.
- (And a small change in propertyHelper to reduce code duplication in function call.)
2015-05-18 18:01:00 +02:00
Mike Pennisi 67e9e070ef Correct error messages
The `testBuiltInObject` function verifies the presence of the specified
properties for *all* object types (not just function objects). Update
the error messages to reflect this.
2015-04-21 17:58:10 -04:00
Mike Pennisi c27938a123 Fix bug in `isWritable` utility function
Only attempt to re-set the property value in cases where it was
successfully modified as part of the function's execution. This avoids
errors when the underlying value is not writable. Rename the internal
result-tracking variable to make this more clear.
2015-04-21 15:00:26 -04:00
Mike Pennisi c91267235c Extend assertion error messages
When invoked without a custom assertion message, `assert.sameValue` and
`assert.notSameValue` automatically create a message that describes the
actual and expected values.

Extend both assertion methods to also include this information in cases
where a custom message has been specified.
2015-04-21 13:25:02 -04:00
Brian Terlson fd6f206d69 Merge pull request #194 from arv/function-length-is-configurable
Function length property is configurable
2015-04-08 15:58:30 -07:00
Rick Waldron d797bb979e Import tests from Google V8 (Array.prototype.{fill, find, findIndex}, Array.{from, of})
These tests are derived from the following files within the Google V8 project:

    	test/mjsunit/harmony/array-fill.js
    	test/mjsunit/harmony/array-find.js
    	test/mjsunit/harmony/array-findindex.js
    	test/mjsunit/harmony/array-from.js
    	test/mjsunit/harmony/array-of.js
2015-04-07 09:53:17 -04:00
Erik Arvidsson ad8af4be3a Function length property is configurable
In ES6 the function length property was changed to become
configurable.
2015-03-11 10:42:14 -04:00
Mike Pennisi 9f8f0284c3 Make writability helper function non-destructive
After checking the writability of a given property, restore the property
value to its original state.
2015-03-04 18:43:33 -05:00
smikes 9f884af5cc harness: add checks of descriptor attributes
First check if descriptor is set up correctly, then actually
verify that the attribute (writability, enumerability,
configurability) is as expected.
2015-02-19 18:11:53 -07:00
smikes 65e5aa6f79 fix undefined var 2015-02-14 15:02:49 -07:00
smikes 49abae4f5e rework: remove *PropertyAttributes fns
- this change hits all files that use
dataPropertyAttributesAreCorrect or
acccessorPropertyAttributesAreCorrect

Major changes:
- remove include of runTestCase.js,
dataPropertyAttributesAreCorrect.js and
acccessorPropertyAttributesAreCorrect.js
- add include of propertyHelper.js
- remove function testCase() and call to
function runTestCase()
- instead of collecting test state into booleans,
which are eventually returned from runTestCase,
test conditions and throw errors immediately
- use negative: to check error types instead of
using `instanceof` in a catch() block

Selected commit logs follow:

manual conversion of accessorPropertyAttributesAreCorrect() test
 - remove runTestCase
 - remove wrapping testCase function
 - unindent
 - remove includes of runTestCase & accessor...
 - add include of propertyHelper.js
 - unpack final two args 'true, false' to explicit inline
   tests of isEnumerable and isConfigurable
 - unpack setter test into inline logic
 - unpack getter test into inline logic

used script to replace includes: frontmatter
with propertyHelper.js ; manually added back
references to fnGlobalObject() where needed

additional helper functions

add helper functions for get and writable
duplicate runTestCase so can remove runTestCase.js from
includes of all tests in batch

use keyboard macros to simplify repetitive conversions
remove auto-save file accidentaly committed

minor changes, manually remove runTestCase from remaining files
lint etc. fixes

remove now-obsolete harness files

make strict/nonstrict variants

tests where behavior is different in strict/nonstrict
need two variants

- strict mode throws on assign to read-only element (no setter fn)
- strict mode separates named arguments from arguments[]

fix indentation

cleanup minor issues

reviewing 15.2.3.7-9 tests, found some minor issues

- indentation/spacing
- duplicate test (eg, direct test of value and dataProp...)
- remove needless try/finally
- use assert.. helpers in place of if(is..
- rename some assertions to 'e'

rename assertX to verifyX
new helper fn sameValue
test "set" as well as get
reverse order of checks
restore test of desc2
restore test of length
restore test of ownProperty
incorporate suggestions re order of ops, Object.prototype
add test of sameValue helper
restore return value in getter
restore second defineProperty call
restore check of explicit "false"
restore explicit test of TypeError
set noStrict flag on arguments changes
rename catch var to "e"	b4ad0e6
remove dataPropertyAttributesAreCorrect from tests	0d83ff2
remove accessorPropertyAttributesAreCorrect from tests	bb926f3
remove {data,accessor}Property... fns from harness

fix writable check on array.length

call $ERROR if expected exception not thrown
fix Epected => Expected typo

use assert._isSamevalue
2014-12-10 17:39:16 -08:00
Brian Terlson 1f2f7d062f Move assert helper as well 2014-12-09 13:46:53 -08:00
Brian Terlson 2a74f0ec1b Reorganize ./test 2014-12-07 15:33:09 -08:00