Commit Graph

172 Commits

Author SHA1 Message Date
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
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 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
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
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
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
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
Justin Grant 6c2884eb9e Verify that `Temporal.*.prototype` isn't writeable 2021-12-14 13:38:14 -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 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
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
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