Commit Graph

343 Commits

Author SHA1 Message Date
Ms2ger 820461ef4b Temporal: Extend tests for PlainDate.compare. 2022-06-14 16:45:56 +02:00
Mathias Bynens 997888324e Add missing binding 2022-05-04 07:57:38 -07:00
Philip Chimento 27f0104bc6 Regularize Temporal.*.from() object cloning tests
Each from() method except Calendar and TimeZone should test that when you
pass an instance of that type, the return value is a clone of that
instance, and a distinct object.

These tests existed already for some types; regularize them and add the
ones that didn't exist yet.

In order to test the referenceISODay of a PlainYearMonth we add an
argument to TemporalHelpers.assertPlainYearMonth.
2022-05-03 08:18:02 +02:00
Philip Chimento b4c0aeda20 Bring existing toString options tests in sync with each other
Of the toString() methods that have options for printing a time with
seconds and fractional seconds, PlainTime seems to have the most
comprehensive set of tests. Bring all the others (Duration, Instant,
PlainDateTime, and ZonedDateTime) in sync with PlainTime, and edit the
PlainTime ones where necessary to include improvements from the others.

Tests:
  - fractionalseconddigits-invalid-string.js: copy and expand on
    PlainTime's more comprehensive set of invalid strings. Add assertion
    message. Fix front matter.
  - fractionalseconddigits-non-integer.js: Fix front matter.
  - fractionalseconddigits-out-of-range.js: make sure infinity is tested.
    Add assertion messages. Fix front matter.
  - fractionalseconddigits-undefined.js: copy PlainTime's more
    comprehensive test with whole minutes, whole seconds, and subseconds.
    Copy PlainTime's test of an empty function object. Add more
    descriptive variable names and assertion messages. Fix front matter.
  - fractionalseconddigits-wrong-type.js: inline and delete TemporalHelper
    used here; it was only good for this test anyway. Improve assertion
    messages.
  - smallestunit-valid-units.js: copy PlainTime's test with a second value
    with zero seconds even. Refactor repetitive tests into a loop. Copy
    the invalid unit "era" from the Instant test. Add assertion messages.
2022-04-13 10:46:20 +02:00
Philip Chimento ac19506a01 Add tests ensuring that observable calls are made with options === undefined
Where possible, observable calls originating from within Temporal, that
require an options argument, should pass `undefined` as that options
argument, rather than `{}` or `Object.create(null)`.

See tc39/proposal-temporal#1685.
2022-04-04 16:24:17 -04: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 276e79d62e Deprecate some property helpers
Document the preference for `verifyProperty` over the various other
property-related helper functions.
2022-04-04 11:28:37 -04:00
Philip Chimento 9af34ce28c Rewrite tests that relied on previous branding behaviour
A follow up to the previous commit, this rewrites some tests that relied
on the lack of brand checks for certain Temporal.TimeZone methods.
https://github.com/tc39/proposal-temporal/pull/1693 added brand checks to
these methods.

We can no longer use a plain object time zone or even a Proxy with a real
branded Temporal.TimeZone object as its handler to do these tests, so we
instead create an instance of Temporal.TimeZone and define own accessor
properties on it in order to test the observable property accesses that we
need to see according to the spec text.

This requires an improvement to TemporalHelpers.observeProperty() in order
to be able to log property accesses to Symbol-valued properties.
2022-02-08 15:43:25 -05:00
Mathias Bynens 489a9f8d52 Add tests for \p{…} with properties of strings
This functionality is part of the RegExp `v` flag proposal: https://github.com/tc39/proposal-regexp-set-notation
2022-01-04 09:31:37 -05:00
Philip Chimento 2d1a1b159e Fix parameter names in TemporalHelpers.calendarDateAddUndefinedOptions
I used kind of misleading parameter names in this function, they are not
"one" and "two" of the same thing, but a Temporal.PlainDate and a
Temporal.Duration.
2021-12-14 13:46:13 -05:00
Philip Chimento 8d025ef1d6 Test that non-undefined, non-zoned relativeTo parameters are converted to PlainDate
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1873

This adds a new Temporal helper calendar that asserts that its dateAdd()
method is always called with a PlainDate instance. This allows testing
that relativeTo parameters are always converted to PlainDate if they are
not ZonedDateTime and not undefined. Prior to the normative PR, they
would be converted to PlainDateTime instead.

Additionally and optionally, the helper calendar can also assert that its
dateAdd() method is called with a specific PlainDate instance. This allows
testing that the instance is the same PlainDate passed as the relativeTo
parameter (in the case of Duration methods) or is the receiver (in the
case of PlainDate methods). For the PlainDateTime and PlainYearMonth
methods the PlainDate instance is synthesized internally so there is no
need to assert that dateAdd() is called with a specific instance.
2021-12-14 13:39:19 -05:00
Philip Chimento cba42e88c7 Tests for string shorthand API in round() and total()
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1875

For convenience, adds some functions to TemporalHelpers to assert that two
Temporal objects are equal, for Duration, Instant, PlainDateTime,
PlainTime, and ZonedDateTime.
2021-11-16 17:06:06 -05:00
Rick Waldron b1f3390fe4
Features: remove duplicate "cleanupSome" feature (#2892)
* Features: remove duplicate "cleanupSome" feature

* Replace feature flag in harness file

Co-authored-by: Mike Pennisi <mike@mikepennisi.com>
2021-11-04 13:27:30 -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
rwaldron addfd8bf3d fix: ensure that symbol args as message don't break assert.compareArray 2021-10-05 15:16:53 -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
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 78554b2dac fix: update assert.compareArray.format to accept "spreadable" 2021-09-24 11:21:44 -04:00
Leo Balter 61bd4e9453 Add identity tests for the assert.throws 2021-09-21 16:45:27 -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
Rick Waldron 6540b15597
chore: migrate $ERROR -> throw new Test262Error in .jshintrc, harness/sta.js (#3122) 2021-07-29 12:38:45 -07:00
rwaldron 488eb365db chore: migrate $ERROR -> throw new Test262Error in harness/ & test/harness 2021-07-21 15:15:55 -04:00
Frank Yung-Fong Tang bd03c96b60 porting over the Temporal asserts to temporalHelpers.js
Per suggestion by https://github.com/tc39/test262/pull/3049#discussion_r672675461
2021-07-21 09:10:40 -04:00
jugglinmike 162e8be99f
Add tests for Temporal.now.plainDateTime (#3037)
* Temporal.now.plainDateTime: import tests from prop

* Add required metadata

* Correct invalid test

Ensure the error is thrown due to the invocation of the provided method.
Add a separate test to verify how the method is invoked.

* Remove duplicated assertions

* Improve coverage

* Rewrite test to focus on Calendar parameter

The observable interactions with the "timeZone" parameter are verified
by another test which is named for that purpose.

* Remove non-standard test

This test's title suggests that it was intended to verify the behavior
when the "calendar" parameter was undefined. The expected behavior in
that case depends on the presence of a builtin calendar named
"undefined." Test262 cannot definitively assert the presence or absence
of such a calendar.

In contrast to the title, the test body actually uses the calendar name
"japanese."  Test262 cannot definitively assert the presence or absence
of such a calendar.
2021-07-16 09:25:55 -04:00
Paul Bakker a6a895db12
Remove usage of rest and default parameters in harness (#3034)
Also see https://github.com/tc39/test262/issues/3032
2021-07-02 09:04:13 -04:00
Frank Yung-Fong Tang 9997a26c7d
Fix tests on {localeMatcher: "lookup"} (#3008)
* Fix test for only {localeMatcher: "lookup"}

The expectation that "sr-Thai-RS" would be returned is only true with the 
9.2.2 BestAvailableLocale ( availableLocales, locale )
https://tc39.es/ecma402/#sec-bestavailablelocale
algorithm used by 9.2.3 LookupMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-lookupmatcher

The default for localeMatcher is "best fit" but not "lookup" for all Intl objects.

And for 9.2.4 BestFitMatcher ( availableLocales, requestedLocales )
https://tc39.es/ecma402/#sec-bestfitmatcher
It may not match "sr-Thai-RS" for "sr"  and return ["de", "zh-CN"] instead. Therefore, we need to change this test to only test on {localeMatcher: "lookup"}

* Add option to getLocaleSupportInfo

Needed to test different localeMatcher

* only test for "lookup" localeMatcher

* Get the info based on the localeMatcher

* pass in localeMatcher to getLocaleSupportInfo
2021-06-24 13:37:33 -04:00
Linus Groh 10fc95cacb
Don't use function argument destructuring in regExpUtils.js (#3000)
This increases compatibility with less advanced engines that only have
partial support for recent language features like assignment patterns.
2021-05-28 19:47:36 -04:00
Frank Yung-Fong Tang f9a834c05e Update testIntl.js 2020-12-16 11:59:06 -05:00
Rick Waldron 0e7319c015 atomicsHelper.js: Add $262.agent.setTimeout to defines 2020-10-19 17:48:00 -04:00
Rick Waldron 6d8ab9c35e Coverage: more Atomics.waitAsync tests, fixes, improved messages. 2020-10-08 17:25:45 -04:00
Rick Waldron 04517c7ded Remove erroneous ArrowFunction 2020-10-07 16:43:48 -04:00
Rick Waldron 8aacff591c Standardize built-in constructor testing 2020-10-06 12:01:34 -04:00
Rick Waldron 8250b886b0 Create "Test262Error.thrower" as replacement for "$ERROR". Define $ERROR as Test262Error.thrower 2020-09-16 17:36:54 -04:00
Yusuke Suzuki e8cdf923ef Property clearing code of RegExp constructor is wrong
This code is setting values to $1 etc., which can be non-writable or accessors.
For example, https://github.com/tc39/proposal-regexp-legacy-features/ is specifying them as accessors, and they should throw an error when
it is done in strict code. We should execute `(/(?:)/).test("");` to clear them.
2020-09-02 15:32:18 -04:00
Alexey Shvayka 9e75c60028 Gracefully handle nullish arguments in harness/compareArray 2020-08-31 15:17:24 -04:00
Richard Gibson 24c6732806 Revert "Improve assert.throws output"
This reverts commit 2f9392f288.
2020-08-21 15:58:21 -04:00
Richard Gibson 6207a8058a Improve assert.throws output 2020-08-21 15:58:21 -04:00
Richard Gibson 93ff9b7262 Replace incorrect use of $DONOTEVALUATE 2020-08-21 15:58:21 -04:00
Richard Gibson 46e26a99a6 Add requirement distinguishing $DONOTEVALUATE from Test262Error 2020-08-21 15:58:21 -04:00
Gus Caplan 5f99d05c6a native function validator for your consideration 2020-08-04 19:44:31 -04:00
Gus Caplan 156186aee2 New NativeFunction tests 2020-08-04 19:44:31 -04:00
Leo Balter 5a01caed71 Add feature tag for cleanupSome
The WeakRefs proposal advanced to Stage 4 but cleanupSome moved back to a Stage 2 status.
The tests should remain in Test262 for now but this feature flag should help users to
filter tests out.
2020-07-21 16:57:50 -04:00
Leo Balter 2e127ec40e Rename usage of master to main
Ref #2699
2020-07-15 15:47:15 -04:00
Frank Tang 3c89cde3e0 Intl.DisplayNames make type required
Update the tests to the latest version after we make
the type option now required

Spec:
https://tc39.es/proposal-intl-displaynames/

Changes of spec:
https://github.com/tc39/proposal-intl-displaynames/pull/76
https://github.com/tc39/proposal-intl-displaynames/pull/83
2020-07-10 19:19:34 -07:00
Rick Waldron 529cff8ee6 Atomics: corrections 2020-06-24 12:26:41 -04:00
Rick Waldron 7e603ae236 Atomics: fix mispelled harness function name 2020-06-24 12:26:41 -04:00
Rick Waldron 11a1eabcc6 Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer 2020-06-24 12:26:41 -04:00
André Bargull 649d0d2c9a Update list of non-algorithmic numbering systems
Per https://github.com/tc39/ecma402/pull/438
2020-06-24 12:11:36 -04:00
Alexey Shvayka fd90d58f05 Change `alphanum` to character class
Co-Authored-By: Ross Kirsling <rkirsling@gmail.com>
2020-04-29 17:22:05 -04:00
Alexey Shvayka d3b3e5e586 Make `alphanum` a non-capturing group 2020-04-29 17:22:05 -04:00
Alexey Shvayka 4371e3ae36 Remove unnecessary capture group 2020-04-29 17:22:05 -04:00
Alexey Shvayka af05e8e4f7 Revert "Simplify alphanum regex in testIntl.js"
This reverts commit d57bd9d4bd.
2020-04-29 17:22:05 -04:00
Ross Kirsling d57bd9d4bd Simplify alphanum regex in testIntl.js 2020-04-23 10:47:32 -04:00
Rick Waldron 127fa27720 Atomics: remove erroneous argument from getReport() in harness/atomicsHelper.js 2020-04-23 10:32:55 -04:00
Rick Waldron e9ee3dcd62 Atomics: add setTimeout, getReportAsync & safeBroadcastAsync to harness/atomicsHelper .js 2020-04-23 10:32:55 -04:00
André Bargull a52517464f Add Unicode and Transformed extension canonicalisation
Generated using the make_intl_data.py script.
2020-04-09 09:20:55 -04:00
André Bargull 1c93566e66 Update language tag mappings to CLDR 36.1
Generated using the make_intl_data.py script.
2020-04-09 09:20:55 -04:00
André Bargull 756ee6a171 Update list of numbering systems 2020-04-09 09:20:55 -04:00
André Bargull 7556d59fe7 Update list of Intl service constructors
Add RelativeTimeFormat, ListFormat, and DisplayNames to the list of Intl
service constructors.
2020-04-09 09:20:55 -04:00
Shu-yu Guo 966fc11862 Migrate FinalizationRegistry tests to per-item callback API 2020-04-01 16:45:40 -04:00
Alexey Shvayka 96cf75770e Harness: properly format negative zero 2020-03-25 12:03:05 -04:00
Alexey Shvayka ad046ceddd Avoid using Array.isArray directly 2020-03-25 11:59:43 -04:00
Alexey Shvayka 79146e5cf4 Bring back `verifyProp` param to `isWritable` 2020-03-23 18:19:01 -04:00
Alexey Shvayka 2abfc8cf9d Remove unused `verifyProp` paramter from `isWritable` 2020-03-23 14:49:12 -04:00
Alexey Shvayka 86b94099ad Increase unlikely array length 2020-03-23 14:49:12 -04:00
Alexey Shvayka 17fc10942e Fix isWritable throwing RangeError on Array "length" 2020-03-23 14:49:12 -04:00
Daniel Ehrenberg c6dd620ad3 Rename FinalizationGroup to FinalizationRegistry
Corresponds to https://github.com/tc39/proposal-weakrefs/pull/183

(Note, this is untested)
2020-02-20 12:13:29 -05:00
Leo Balter 6b66b82d88 Cleanup compareArray and deepEqual assertions, remove assert._formatValue
Fixes #2372
2019-10-09 17:57:10 -04:00
Leo Balter d49777de27 Whitespace cleanups. CRLF => LF 2019-10-08 20:44:09 -04:00
Mike Pennisi a9111d7144 lint: add rule to verify use of harness files
Verify that every test file which references a harness file using the
"includes" directive also contains at least one reference to a value
defined in the harness file.

To support this check, extend each harness file with a list of values
which it defines.
2019-09-25 14:00:50 -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 a03455a080
Uncomment lines (#2360)
Ref #2353

This uncomment lines meant to be in the code for the graceful end of the async GC executions.
2019-09-23 13:49:32 -03:00
Leo Balter 3bfb341203 Fixes after test feedback 2019-09-23 12:26:02 -04:00
Leo Balter 08844700fe Update tests for GC hook, apply async
- Fix incorrect tests for WeakRefs

Ref #2239
Fixes #2260
Fixes #2256
2019-09-23 12:26:02 -04: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
André Bargull c596d9674e Update `canonicalizeLanguageTag` helper to match UTS 35 canonicalisation 2019-07-22 02:12:20 -07:00
André Bargull 1edeb484b8 Include locales supported through fallback when testing fallbacks
This test started failing when updating to ICU 64, because ICU supports "zh"
and "zh-Hans-CN", but not explicitly also "zh-Hans", which is required for this
test to pass. The same kind of error is reproducible with ICU <64 when "Guru"
is added to the list of script codes in 'testIntl.js', because ICU supports
"pa-Guru-IN", but "pa-IN" isn't explicitly supported, too.

So, change this test to also check 'byFallback' to see if a locale is supported.

Drive-by change:
- Modernise the test to make it more readable how subtags are combined.
- Also add "419" to the list of region codes to cover the digit region syntax.
2019-07-22 02:12:05 -07:00
André Bargull f7e8dba39b Update tests to parse language tags as Unicode BCP 47 Locale Identifiers
harness/testIntl.js
- Add now invalid tags to getInvalidLanguageTags, these tags were previously used in test files changed in this commit.
- Update isCanonicalizedStructurallyValidLanguageTag regular expressions.

test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
- Moved five now invalid tags to getInvalidLanguageTags function in testIntl.js

test/intl402/Intl/getCanonicalLocales/preferred-grandfathered.js
- All irregular grandfathered tags are invalid now
- Regular grandfathered with extlang subtags are now also invalid
- Regular grandfathered with variant-like subtags are still valid

test/intl402/Intl/getCanonicalLocales/weird-cases.js
- Revert changes from last commit
- "x-u-foo" is now invalid and was moved to getInvalidLanguageTags function

test/intl402/ListFormat/constructor/constructor/locales-valid.js
test/intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js
test/intl402/Segmenter/constructor/constructor/locales-valid.js
- Irregular grandfathered and privateuse only are no longer valid language tags

test/intl402/language-tags-canonicalized.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js

test/intl402/language-tags-invalid.js
- Invalid tags list in this file was a subset of getInvalidLanguageTags, so replaced with getInvalidLanguageTags to get more coverage

test/intl402/language-tags-valid.js
- Same changes as in test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js
2019-07-21 05:44:21 -07:00
Alexey Shvayka 57f0884396 Use SameValue in verifyProperty helper (#2185) 2019-06-12 14:14:14 -04:00
Leo Balter 7e7b9e103d
Port tests from Promise.all to Promise.allSettled (#2124) 2019-04-17 14:17:54 -04:00
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