Commit Graph

529 Commits

Author SHA1 Message Date
Frank Tang b064eb64f3 Add tests for Temporal.Calendar.p*.weekOfYear
(Philip, March 2022: This was originally Frank's PR #3060. I did some
reformatting, removed a test that didn't exercise the whole feature, and
combined some duplicate tests with some existing tests.)
2022-04-04 16:34:01 -04: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
Jesse Alama fe40aea50c Emit fallback day 1 2022-03-29 16:58:36 -07:00
Jesse Alama 9aaa22cb06 Ensure fallback years values are present 2022-03-29 16:58:36 -07:00
Jesse Alama ee1f96235b Ensure reference data is emitted when calendarName = 'always'
References:

+ https://github.com/tc39/proposal-temporal/issues/1971
2022-03-29 16:58:36 -07:00
Jesse Alama 76b0bafba6 Update test/built-ins/Temporal/Duration/compare/twenty-five-hour-day.js
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2022-03-29 16:50:41 -07:00
Jesse Alama 2aa754b7cf Add test for DST balancing
References:

+ https://github.com/tc39/proposal-temporal/issues/1791

Thanks @ptomato for the suggestion to use
`springForwardFallBackTimeZone`.
2022-03-29 16:50:41 -07:00
Philip Chimento 3eea1a7959 Add tests for various invalid ISO strings for PlainDate
These tests check API entry points that convert strings to
Temporal.PlainDate, with a list of various strings that are all not valid
for that context according to ISO 8601.
2022-03-29 11:26:53 -04:00
Philip Chimento ad74a4ebba Rename some "argument-string" tests to be more specific
I'd like to add basic functionality tests for string arguments, and these
tests are testing something more specific: that a Get of the "overflow"
property on the passed-in options object is observable. Rename
accordingly.
2022-03-29 11:26:53 -04:00
Frank Tang 52af2b6763 Add tests for Temporal.Calendar.p*.yearMonthFromFields
(Philip, March 2022: This was originally Frank's PR #3061. I did some
reformatting, removed duplicate tests, and combined with some existing
tests.)
2022-03-29 11:23:43 -04:00
Frank Tang 0bad719e79 Add test for Temporal.Duration.p*.abs
(Philip, March 2022: This was originally Frank's PR #3062. I did some
reformatting and removed duplicate tests)
2022-03-29 11:23:43 -04:00
Frank Tang f23602f6ce Add test for Temporal.Duration.p*.negated
(Philip, March 2022: This was originally Frank's PR #3063. I did some
reformatting and removed duplicate tests)
2022-03-29 11:23:43 -04:00
Frank Tang b8af7ff369 Add test for Temporal.Duration.p*.toJSON
(Philip, March 2022: This was originally Frank's PR #3064. I did some
reformatting and removed duplicate tests)
2022-03-29 11:23:43 -04:00
Frank Tang 2c8b69f8d0 Add tests for Temporal.Duration.p*.with
(Philip, March 2022: This was originally Frank's PR #3065. I did some
reformatting, removed duplicate tests, and combined with some existing
tests.)
2022-03-29 11:23:43 -04:00
Ms2ger f964584508 Expand overflow-invalid-string.js tests. 2022-03-25 11:18:13 -07:00
Jesse Alama 7b78d4be74
Port some basic Temporal.PlainDateTime tests from Demitasse to test262 (#3430)
* Create a Temporal.PlainDateTime with all arguments supplied.

Migrates some tests that currently exist in the
proposal-temporal repo.

* Check all data in Temporal.PlainDateTimes, variously constructed

Enrich existing tests to check all basic data in the
instance of `Temporal.PlainDateTime`, not just a single
field.

These additional checks were motivated by the migration of
existing Demitasse tests in the proposal-temporal repo to
test262. The Demitasse tests check more than a single
field.
2022-03-21 12:16:18 -07:00
Frank Tang 7d5b0ec6f4 Add test for Temporal.Instant.p*.add
This was originally Frank's PR #3075. I rebased it, added assertion
messages, did some reformatting, and combined with some existing tests.
2022-03-14 13:52:04 -04:00
Frank Tang 11c2559651 Add tests for Temporal.Instant.p*.subtract
(Philip, March 2022: I rebased Frank's original PR #3076, did some
reformatting, removed duplicate tests, and combined with some existing
tests.)
2022-03-14 13:52:04 -04:00
Ms2ger 104e5e8fab Test more invalid values for roundingMode. 2022-03-11 09:51:57 +01:00
Ms2ger 51ce1fa00f Expand some Duration#toString() tests. 2022-03-10 17:05:49 -05:00
Ms2ger c6c31c8dac Add and expand tests for Duration constructor / from(). 2022-03-10 17:05:49 -05:00
Ms2ger d45476b9fd Add a test for observable calls in Temporal.Duration constructor. 2022-03-10 17:05:49 -05:00
Philip Chimento f7fb969cc4 Add tests for T time designator prefix not allowing space
Here's a test I should have included in #3395. It's allowed to replace the
"T" in the middle of an ISO string with a space, but not when the "T" is a
time designator prefix. This assertion ensures that implementations make
this distinction correctly.
2022-02-28 14:41:18 -05:00
Ms2ger 2f592de0aa Port tests for PlainTime. 2022-02-28 14:32:34 -05:00
Ms2ger 18ce639a4c Port tests for PlainTime. 2022-02-21 16:02:05 -05:00
Ms2ger 1fe9bd3951 Add a basic test for PlainDateTime#toPlainTime. 2022-02-21 16:02:05 -05:00
Ms2ger 0370240141 Port tests for PlainTime. 2022-02-16 09:39:30 -05:00
Ms2ger df873eed1a Port tests for PlainYearMonth#{add,subtract}. 2022-02-08 15:46:11 -05:00
Ms2ger f98a00bc69 Port tests for PlainYearMonth#{since,until}. 2022-02-08 15:44:41 -05:00
Ms2ger 8848ee91e8 Remove smallestunit-disallowed-units.js.
It is covered by smallestunit-invalid-string.js and largestunit-smallestunit-mismatch.js.
2022-02-08 15:44:41 -05:00
Jesse Alama 525313395b Add tests for with() copying defined properties of source object
https://github.com/tc39/proposal-temporal/issues/1910 found a bug in an
indentation level of a line in the Temporal proposal, which affected the
outcome of the PreparePartialTemporalFields abstract operation. This adds
tests for all entry points that use that abstract operation, to make sure
the behaviour is correct: only defined properties are copied in with()
methods.

This was a normative change that achieved consensus at the December 2021
TC39 meeting.
2022-02-08 15:43:25 -05:00
Philip Chimento 6322630064 Add Duration.toString test for fractionalSecondDigits/smallestUnit
https://github.com/tc39/proposal-temporal/pull/1956 clarified that the
fractionalSecondDigits and smallestUnit options to
Temporal.Duration.p.toString() specified the exact number of digits after
the decimal point, no more and no less.

This was a normative change that achieved consensus at the December 2021
TC39 meeting.
2022-02-08 15:43:25 -05:00
Philip Chimento 8e0c895c4d Test 'T' time designator prefix in PlainTime strings
https://github.com/tc39/proposal-temporal/pull/1952 added support for time
designator prefixes in PlainTime strings. This adds three tests to all
entry points that convert an ISO string to a PlainTime:

- no-implicit-midnight: ISO strings with only a date and no time are no
  longer accepted. Previously they were implicitly interpreted as 00:00.
- with-time-designator: Tests that various forms of string with time
  designator are correctly parsed.
- time-designator-required-for-disambiguation: Tests various cases where
  a string without a time designator is ambiguous and therefore the time
  designator is required, as well as various cases that implementations
  might assume are ambiguous but in fact are not.

This was a normative change that achieved consensus at the December 2021
TC39 meeting.
2022-02-08 15:43:25 -05:00
Philip Chimento 7b45a862b1 Test rounding mode in Duration strings with fractional units
https://github.com/tc39/proposal-temporal/pull/1907 was a bug that caused
negative Duration strings with fractional units to be rounded incorrectly.
Add tests that ensure the rounding mode is correct.

This was a normative change that achieved consensus at the December 2021
TC39 meeting.
2022-02-08 15:43:25 -05: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
Jesse Alama f3c485d6da Ensure branding tests for Temporal.Calendar and TimeZone methods
https://github.com/tc39/proposal-temporal/pull/1693 added checks for the
receiver of certain Temporal.Calendar and Temporal.TimeZone methods. Add
branding tests for these methods, similar to the already existing branding
tests.

This was a normative change that achieved consensus at the December 2021
TC39 meeting.
2022-02-08 15:43:25 -05:00
Ms2ger d71cf3a339 Reorganize tests for PlainYearMonth#{since,until} largestUnit option. 2022-02-03 12:29:16 -05:00
Philip Chimento 4f20476e0a Add tests for largestUnit/smallestUnit mismatch
These tests already existed for PlainDate. Copy them to the other types
(and use the constructor instead of from() in order to be as simple as
possible)
2022-02-01 18:02:08 -05:00
Philip Chimento 06ced3f812 Add forgotten PlainDate tests
I forgot to add these to PlainDate, testing what happens when we pass
undefined as the value for the largestUnit option. Similar tests already
exist for the other types.
2022-02-01 18:02:08 -05:00
Philip Chimento 4382f17f29 Expand largestUnit and smallestUnit invalid strings tests
Some of these (in PlainDate) had already been rewritten to test more
invalid strings that are otherwise valid units. This commit takes these
improvements and brings them to all of the similar tests for other types'
since() and until() methods.
2022-02-01 18:02:08 -05:00
Jesse Alama 7d82f8ac63 Add tests for invalid extended year "-000000"
https://github.com/tc39/proposal-temporal/issues/1753 records the
consensus reached at the October 2021 TC39 meeting to disallow "-000000"
as an extended year, both in Date.parse and Temporal. This adds tests for
the Temporal part of that.
2022-02-01 17:59:02 -05:00
Philip Chimento 141aca7dba Test offset property in ZonedDateTime property bags
https://github.com/tc39/proposal-temporal/pull/1893 was a bug that caused
the 'offset' property to be ignored in ZonedDateTime property bags. Add
tests that ensure it is not ignored.

This was a normative change that achieved consensus at the October 2021
TC39 meeting.
2022-02-01 17:59:02 -05:00
Jesse Alama 7835f64ae0 Check relativeTo for certain non-zero years, weeks, months, and days
https://github.com/tc39/proposal-temporal/pull/1780 fixed a typo in the
UnbalanceDurationRelative abstract operation, which should affect the
entry points tested here.

This was a normative change that achieved consensus at the October 2021
TC39 meeting.
2022-02-01 17:59:02 -05:00
Ms2ger 331c144f2e Test limits in PlainDate#toPlainYearMonth. 2022-02-01 17:58:30 -05:00
Ms2ger 20329ef359 Test limits in PlainYearMonth.from. 2022-02-01 17:58:30 -05:00
Ms2ger f857cf9968 Test limits in PlainYearMonth constructor. 2022-02-01 17:58:30 -05:00
Ms2ger 516f9a9083 Test PlainYearMonth.prototype.toString. 2022-02-01 17:58:30 -05:00
Ms2ger fddbb4fdf7 Test PlainYearMonth.prototype.toPlainDate. 2022-02-01 17:58:30 -05:00
Ms2ger 51d5cf9a44 Test PlainYearMonth.prototype.valueOf. 2022-02-01 17:58:30 -05:00
Ms2ger ab6fab987e Test PlainYearMonth.prototype.equals. 2022-02-01 17:58:30 -05:00
Ms2ger 405f4fac4b Test PlainYearMonth.compare. 2022-02-01 17:58:30 -05:00
Ms2ger 6ba72412ab Test PlainYearMonth.prototype.with. 2022-02-01 17:58:30 -05:00
Ms2ger 7215b9387f Remove duplicated tests for PlainYearMonth.from overflow.
This is covered in overflow-wrong-type.js.
2022-02-01 17:58:30 -05:00
Ms2ger dff7c70254 Avoid unrelated invalid input in PlainDate.from test. 2022-01-28 13:17:31 -05:00
Ms2ger 158d0bf35f Test PlainYearMonth constructor, from. 2022-01-28 13:17:31 -05:00
Ms2ger 543c8ee938 Pass arguments in PlainYearMonth constructor test.
The arguments are required, so this should make the test more robust.
2022-01-28 13:17:31 -05:00
Ms2ger d86b913c11 Test Temporal.Now. 2022-01-24 13:36:43 -05:00
Ms2ger 4eb14032ae Basic tests for PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger f768a24ab6 Test singular units in PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger 00b9691218 Test overflow 'constrain' in PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger a042241ed2 Test overflow 'reject' in PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger ef0b1507fc Test balancing in PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger 3fd429b231 Test PlainDate#{add,subtract}. 2022-01-24 13:35:39 -05:00
Ms2ger 3dfc587f36 Test PlainDate#{since,until}. 2022-01-24 13:35:39 -05:00
Ms2ger a46aecc12a Test PlainDate.from with more objects. 2022-01-24 13:35:39 -05:00
Ms2ger 6bf7d8207a Test functions as options in PlainDate.from. 2022-01-24 13:35:39 -05:00
Ms2ger b81ce78746 Test PlainDate.from with a number. 2022-01-24 13:35:39 -05:00
Ms2ger 4ec469c68c Test PlainDate.from with various strings. 2022-01-24 13:35:39 -05:00
Ms2ger 6f689c6c19 Rename PlainDate/from/argument-string.js. 2022-01-24 13:35:39 -05:00
Ms2ger 6ee33f1c86 Test PlainDate.from with trailing junk in string argument. 2022-01-24 13:35:39 -05:00
James Wright e87b0048c4 Include missing semicolons in Temporal tests. 2022-01-19 13:48:03 -05:00
Philip Chimento 17b3c567ff Add more variations of ISO strings to "timezone-string-datetime" tests
Some of these tests have a larger variation of valid ISO strings that they
test, and others don't. Use the larger variation across all of these
files.
2022-01-19 13:47:43 -05:00
Philip Chimento ff62561247 Ensure tests in main suite do not use Intl time zones
This requires a few adjustments of time zone names and offsets in some
places. The only named time zone that is required to be supported by an
implementation not supporting ECMA-402 is "UTC".
2022-01-19 13:47:43 -05:00
Philip Chimento 6058710478 Improve various assertion messages 2022-01-19 13:47:43 -05:00
Philip Chimento dcf184a0ee Minor formatting fix 2022-01-19 13:47:43 -05:00
Frank Yung-Fong Tang 9bfdf89edc Fix incorrect argument
2nd argument of TemporalHelpers.assertPlainDate is year, not Temporal.PlainDate object.
2022-01-07 13:14:27 -05:00
Ms2ger 7bfda9f10b Add tests for overflow in PlainDate.from(). 2022-01-04 09:26:28 -05:00
Ms2ger aa77abd928 Add tests for limits in PlainDate. 2022-01-04 09:26:28 -05:00
Ms2ger 88f2eb7329 Add a test for PlainDateTime#toPlainDate(). 2022-01-04 09:26:28 -05:00
Ms2ger 83bffcc6fd Add a test for PlainMonthDay#toPlainDate(). 2022-01-04 09:26:28 -05:00
Ms2ger 3f88250aca Add a test for PlainYearMonth#toPlainDate(). 2022-01-04 09:26:28 -05:00
Ms2ger 439ac8c2dc Add tests for PlainDate.compare(). 2022-01-04 09:26:28 -05:00
Ms2ger 78b8f7945c Add tests for PlainDate#equals(). 2022-01-04 09:26:28 -05:00
Ms2ger 0855621088 Add tests for PlainDate#toString(). 2022-01-04 09:26:28 -05:00
Philip Chimento af00d69c39 Some progress on not using time zone names that require Intl
In order to test this functionality on hosts that don't have Intl, we have
to use "UTC" and offset-only time zones here, as the full set of IANA time
zone names are not required to be supported across all hosts.

This makes some progress on https://github.com/tc39/test262/issues/3253
2021-12-14 13:46:13 -05:00
Philip Chimento e3395bb1e4 Fix some copy-paste errors 2021-12-14 13:46:13 -05:00
Philip Chimento 5e9da36a2f Bring formatting in line with other tests
Other tests similar to these were changed to use a for-of loop, so do the
same here.
2021-12-14 13:46:13 -05:00
Philip Chimento 9c5ec87dba Test ISO strings with multiple fractional second parts
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1796
2021-12-14 13:39:19 -05:00
Jesse Alama 0b8319355b Test `since` for PD(T) with `largestUnit` = `year`, `month`
Nails down intended behavior of `PlainDate` and
`PlainDateTime`'s `since` that is already true in the
polyfill but which was specified in a buggy way (and hence
potentially not true in an implementation of Temporal).
Add similar tests for Instant, PlainTime, PlainYearMonth, and
ZonedDateTime.

Reference:
https://github.com/tc39/proposal-temporal/pull/1881
2021-12-14 13:39:19 -05:00
Jesse Alama 85973b35e4 Rendering Duration with negative components
A rendered Duration that was constructed with negative
componented begins with a `-`, but that's the last
time a minus sign appears.
2021-12-14 13:39:19 -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 0184842b09 Test rejection of "Z" UTC designators in Plain strings
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1874
2021-12-14 13:39:19 -05:00
Justin Grant 6c2884eb9e Verify that `Temporal.*.prototype` isn't writeable 2021-12-14 13:38:14 -05:00
Frank Tang 970865e44d Rename to returns-string.js 2021-12-06 09:12:27 -05:00
Frank Tang 78907d6393 Move toLocaleString testing to intl402
Move part of the test of toLocaleString which depends on
15 Amendments to the ECMAScript® 2021 Internationalization API Specification
to intl402. Keep behavior specified in earlier chapters in built-ins
2021-12-06 09:12:27 -05:00
Frank Yung-Fong Tang 46f165ae49 change not-required timezone id to required UTC 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang 254c3107ab Replaced not required timezone id w/ required UTC 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang f801aa9468 add back UTC timezone 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang 2808c07dc5 Move all tests which have IANA timezone to intl402 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang 2576b650af fix the checking 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang ef856ec3b3 Move IANA TimeZone test to intl402 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang 0c161cb803 Move IANA TimeZone tests to intl402
IANA TimeZone name other than "UTC" is only required if the implementation " includes the ECMA-402 Internationalization API"
https://tc39.es/proposal-temporal/#sec-isvalidtimezonename
Therefore, we need to split the test and keep this one  without checking "America/Vancouver"
Add a case to test withtout the ":"
2021-12-02 09:46:33 -05:00
Sarah GHP 4b7f8b49cc Adds invalid constuction options 2021-11-30 15:00:51 -05:00
Sarah GHP abf437c338 Add test for invalid mixed cal 2021-11-30 15:00:51 -05:00
Sarah GHP 9c6ecf5326 Tests disallowed smallest and largest unit arguments to PYM.since 2021-11-30 15:00:51 -05:00
Sarah GHP 927ad3051f Remove unused includes 2021-11-30 14:59:01 -05:00
Sarah GHP da9d81a694 Add basic tests converted from demitasse 2021-11-30 14:59:01 -05:00
Ms2ger de8faff7d7 Add some PlainDate#until() tests. 2021-11-30 14:52:26 -05:00
Philip Chimento 1d09acaac1 Fix not-callable getOffsetNansecondsFor tests
Unfortunately, in #3304 I made a last-minute mistake when I added the
uncallable value to the assertion message, and neglected to test it;
Symbols can't be converted to strings like that, so these tests would
fail. This fixes the assertion messages.
2021-11-30 14:36:59 -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
Philip Chimento ae53326189 Test TypeError is thrown when getOffsetNanosecondsFor is not callable
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1829
In a previous version of the specification, there was a fallback to the
intrinsic getOffsetNanosecondsFor when it was undefined.
2021-11-16 17:06:06 -05:00
Sarah GHP 171d4382de Add tests for RangeErrors on fractional inputs to Duration constructor 2021-11-16 17:06:06 -05:00
Philip Chimento 3dbf940c9b Test removal of sub-minute time zone offsets in ISO strings
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1871
2021-11-01 14:07:02 -04:00
Philip Chimento 0dec11d949 Test positive and negative offset time zones in FormatTimeZoneOffset
Tests for the normative change made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1833
2021-11-01 14:07:02 -04:00
Philip Chimento 615408bc60 Temporal.ZonedDateTime.p.with() with broken offset property on receiver
Tests for the normative change made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1865
2021-11-01 14:07:02 -04:00
Philip Chimento 4158545044 Temporal.PlainTime property bags
Tests for the normative change to Temporal made in
https://github.com/tc39/proposal-temporal/pull/1862
2021-11-01 14:07:02 -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
Justin Grant 2c6abf5138 Revert #3250
Fixes #3272 by reverting a change to tests of
`Temporal.PlainDateTime.prototype.since()`.

See tc39/proposal-temporal#1878 for details.
2021-11-01 12:51:28 -04:00
Mike Pennisi fd8d520cab Correct test for Temporal.Instant#toString
Prior to this patch, the modified test invoked the `arrayContains`
utility function without referencing its return value. Unlike Test262's
assertion functions, `arrayContains` does not throw an error when the
expectation is violated, so the prior usage did not influence test
results.

Additionally, the prior version of this test documented incorrect
expectations regarding the expected value produced by the method under
test. Due to the above, these expectations were not enforced.

Correct the test's expectations and enforce those expectations with a
function that will reliably produce an exception if violated.
2021-10-29 15:15:57 -04:00
Ms2ger 2462d8acd9 Check that PlainMonthDay#toPlainDate() rejects out-of-range dates.
Fixes #3252.
2021-10-12 19:30:45 -04:00
Frank Tang adce88e717 mv tests depend on Intl to intl402. 2021-10-08 14:30:06 -04:00
Ms2ger 64a1628d04 Fix bug in PlainDate#since() test.
Fixes #3249.
2021-10-07 09:08:43 -04:00
Frank Yung-Fong Tang 61339fd294
Sync test of Temporal.Calendar.p*.fields to 1750 (#3188)
* Sync test  of Temporal.Calendar.p*.fields to 1750

https://github.com/tc39/proposal-temporal/pull

* add more test

* add more tests for T*.Calendar.p*.fields

* Update test/built-ins/Temporal/Calendar/prototype/fields/long-input.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Update test/built-ins/Temporal/Calendar/prototype/fields/long-input.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Update test/built-ins/Temporal/Calendar/prototype/fields/repeated-throw.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Update test/built-ins/Temporal/Calendar/prototype/fields/reverse.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Update test/built-ins/Temporal/Calendar/prototype/fields/reverse.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Remove loop

* Update test/built-ins/Temporal/Calendar/prototype/fields/long-input.js

Co-authored-by: Ms2ger <Ms2ger@gmail.com>

* Update long-input.js

* Update repeated-throw.js

* Update reverse.js

* ensure the implementation check the content

make sure the validation does not happen after the looping the generator

* add test to check all valid field value

Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2021-10-05 23:03:07 -04:00
Philip Chimento 56e537b916 Consolidate duplicate tests
There were a few tests already in the tree that overlapped ones that I
added in the previous commit. I've consolidated these and taken
information from the deleted ones where applicable, and improved on the
autogenerated assertion messages.
2021-10-01 14:30:12 -04:00
Philip Chimento 77a34cf93f Add Temporal tests
This copies over the tests that previously existed in the
tc39/proposal-temporal repository.

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

In service of https://github.com/tc39/test262/issues/3002
2021-10-01 14:30:12 -04:00
Mike Pennisi d9ddf80479 Revert "Merge pull request #3219 from tc39/rwaldron/migrate-comparearray"
This reverts commit b690cb67be, reversing
changes made to 50dd431dff. This is
necessary because the reverted changeset reduced coverage by an unknown
extent.
2021-10-01 10:18:47 -04:00
Philip Chimento c7ca06acb2
Remove duplicate tests (#3222)
While working on adding the Temporal tests from tc39/proposal-temporal I
noticed that these tests tested the same thing as each of the branding.js
tests in the same directory. This removes the duplicate tests.
2021-09-30 20:17:12 -04:00
rwaldron 4847d9db5a chore: update test/**/*.js to use assert.compareArray wherever applicable 2021-09-24 12:58:15 -04:00
Frank Yung-Fong Tang 16dae73171
improve the case with the version without : (#3204) 2021-09-17 14:02:37 -04:00
Mike Pennisi aa5c2adb7c Improve coverage: zonedDateTime & zonedDateTimeISO 2021-09-13 10:09:42 -04:00
Mike Pennisi 424406b5be Correct metadata 2021-09-13 10:09:42 -04:00
Mike Pennisi 57491d838f Import tests for Temporal.Now.zonedDateTimeISO
These tests originated in the Temporal proposal repository
https://github.com/tc39/proposal-temporal
2021-09-13 10:09:41 -04:00
Mike Pennisi c99ec1780d Import tests for Temporal.Now.zonedDateTime
These tests originated in the Temporal proposal repository
https://github.com/tc39/proposal-temporal
2021-09-13 10:09:41 -04:00
Mike Pennisi 0232d97415 Add tests for Temporal.Now.plainDateTimeISO 2021-09-13 10:09:41 -04:00
André Bargull 0181293d38 "era" and "eraYear" are ECMA-402 only properties.
Both properties are only present when ECMA-402 is supported.
2021-09-02 11:23:23 -07:00
Mike Pennisi 0ecc26b987 Fix error in test for Temporal.now.plainDateTime 2021-09-02 10:03:02 -04:00
Michael Dyck 9cb0746f52 Normalize some YAML
In some recently added tests, the `description` is a multi-line scalar
in flow notation. Change it to block notation.
2021-09-02 10:00:32 -04:00
Philip Chimento 45a913c057
Add branding tests from Temporal (#3138)
Closes: #3137

Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2021-08-11 12:31:23 -07:00
Rick Waldron bb93efdb6b
Automated assertion message update (#3136)
This also required manually fixing the "actual" and "expected" order of many assert.sameValue(...) calls.
2021-08-10 10:40:04 -07:00
Frank Tang 86e23998e3 Add more tests 2021-08-06 18:31:47 -04:00
Frank Tang 88d1ede7d6 Split the test and add more tests 2021-08-06 18:31:47 -04:00
Frank Tang bb4729126c Remove incorrect lines 2021-08-06 18:31:47 -04:00
Frank Tang ee94a2ce7f fix directory name 2021-08-06 18:31:47 -04:00
Frank Tang 35850e5782 Add Temporal.Calendar.prototype.daysIn* tests. 2021-08-06 18:31:47 -04:00
Rick Waldron e6c21464f5 Automated feature flag update 2021-08-05 18:44:17 -04:00
Frank Tang 1c722a8158 fix comments 2021-08-05 18:31:44 -04:00
Frank Tang a87f987e7f add more tests 2021-08-05 18:31:44 -04:00
Frank Tang d554db9438 Fix YAML indent issue 2021-08-05 18:31:44 -04:00
Frank Tang 2d480d4c76 Fix directory name 2021-08-05 18:31:44 -04:00
Frank Tang 52bb16f9a5 Add tests for Temporal.Calendar.prototype.dayOf* 2021-08-05 18:31:44 -04:00
Frank Tang 97967a37b3 fix id 2021-08-05 18:31:06 -04:00
Frank Tang 6cc2d81dab Split to different files and test throwing Error 2021-08-05 18:31:06 -04:00
Frank Tang b5a4033fcc Fix directory name 2021-08-05 18:31:06 -04:00
Frank Tang 932c931a70 Add tests for Temporal.Calendar.prototype.(year|month*|day) 2021-08-05 18:31:06 -04:00
Frank Tang 750ec2b581 Fix YAML 2021-08-05 18:30:13 -04:00
Frank Tang 8ebded4cfa use harness and add more tests 2021-08-05 18:30:13 -04:00
Frank Tang 7418ba62b1 rm throws-range-error.js 2021-08-05 18:30:13 -04:00
Frank Tang b58e01afca Fix YAML 2021-08-05 18:30:13 -04:00
Frank Tang 721245be53 Fix directory name 2021-08-05 18:30:13 -04:00
Frank Tang e17cc7b4bf Add test for Temporal.Calendar.prototype.dateUntil 2021-08-05 18:30:13 -04:00
Frank Tang 1a36125f25 Remove simple.js 2021-08-05 18:27:03 -04:00
Frank Tang 8f2434ba4d Fix directory name 2021-08-05 18:27:03 -04:00
Frank Tang 6ab8e86471 Add test for Temporal.Calendar.p.date(Add|FromFields) 2021-08-05 18:27:03 -04:00
Frank Tang a585faf566 split simple into different files 2021-08-05 18:27:03 -04:00
Frank Tang 173684422c Added back fiels incorrectly removed 2021-08-05 18:27:03 -04:00
Frank Tang df42e9a19b split into different add files 2021-08-05 18:27:03 -04:00
Frank Tang f772019855 Fix directory name 2021-08-05 18:27:03 -04:00
Frank Tang 1195736914 Add test for Temporal.Calendar.p.date(Add|FromFields) 2021-08-05 18:27:03 -04:00
Frank Tang bf1b3f585f Add abstract operation test for dateFromFields 2021-08-05 18:27:03 -04:00
Frank Tang c0b3a5f074 Add test for abrupt completion for dateAdd 2021-08-05 18:27:03 -04:00
Frank Tang 6c077667fc Fix directory name 2021-08-05 18:27:03 -04:00
Frank Tang 4a34d84b20 Add test for Temporal.Calendar.p.date(Add|FromFields) 2021-08-05 18:27:03 -04:00
Michael Dyck 82e0487797 "Normalize" some YAML
In each case, it's the scalar value associated with the "description" key.
Normally in test262, this is written in either:
- block notation (indicated by '>' or '|'), or
- flow notation, single-line, on the same line as the key.

In the cases addressed by this PR, the value is instead written in:
- (1x) flow notation, *multi*-line, or
- (2x) flow notation, single-line, on the line *after* the key.

These are valid YAML, but they're styles that test262 doesn't otherwise use,
so could conceivably confuse people or harnesses.

This PR changes them to block notation.
2021-07-21 16:34:04 -04:00
Linus Groh 0efd2a3baa
Rename all uses of Temporal.now to Temporal.Now (#3069)
See: https://github.com/tc39/proposal-temporal/commit/d0acb66
2021-07-20 15:06:31 -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
Frank Yung-Fong Tang f1f3a2d542
Add test for 12.4.21 of Temporal (#3036)
* Add test for 12.4.21 of Temporal

12.4.21 Temporal.Calendar.prototype.fields ( fields )
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.fields

@sffc @Ms2ger @ryzokuken @ljharb

* move to the right file

* remove from wrong place
2021-07-13 19:39:07 -04:00
jugglinmike aaf4402b4c
Add tests for Temporal.now.instant (#3031) 2021-06-29 11:45:42 -04:00
Mike Pennisi 802f22bf0e Temporal.now.timeZone: improve coverage 2021-06-25 13:52:57 -04:00
Mike Pennisi 19c5e38118 Temporal.now.timeZone: import tests from proposal 2021-06-25 13:52:01 -04:00