Commit Graph

6301 Commits

Author SHA1 Message Date
Justin Grant 425716345f Test Temporal.Instant w/ trailing zeroes in offset
I noticed a small test hole in codecov: we weren't testing
Temporal.Instant parsing with trailing zeroes in the offset.
I also didn't see fractional offset testing, so added that too.
2023-07-27 12:52:25 +02:00
Frank Yung-Fong Tang 9437cab774 Normative: Add new numbering system "kawi" and "nagm"
Adding tests for https://github.com/tc39/ecma402/pull/714
2023-07-25 10:00:13 +02:00
Justin Grant c84752415d Test PlainTime without full ISO strings
Codecov showed that PlainTime strings like "09:00:00Z[UTC]" or
"09:00:00Z" were not being tested. This commit fills that gap.

It'd probably be good to make similar changes for other Plain* types,
but Codecov didn't complain about them so they may be covered
via other tests so it was less urgent.
2023-07-25 09:36:18 +02:00
Justin Grant e8bbfe704f Ensure that non-string TimeZone IDs will throw
This commit fills a test hole found by Codecov: we weren't checking for
the case of a custom time zone whose `id` property returns a non-string
value.

Note that the `id` property is only read in a few places, all on the
ZonedDateTime prototype: `until`, `since`, `equals`, `toString`,
`toLocaleString`, `toJSON`, and `timeZoneId`.
2023-07-25 09:30:37 +02:00
Frank Yung-Fong Tang 92a9eca159
Add tests for ECMA402 PR 786 (#3875)
https://github.com/tc39/ecma402/pull/786

This ECMA402 PR 786 reached TC39 consensus in the July 2023 meeting
2023-07-24 17:47:19 +02:00
Justin Grant 6f146e6f30 Limit offset time zones to minute precision
Modify/add tests for https://github.com/tc39/proposal-temporal/pull/2607
2023-07-18 17:44:19 +02:00
Justin Grant 60e475248d Tests for Temporal PR #2574
Edits Temporal tests to account for changes in
https://github.com/tc39/proposal-temporal/pull/2574.

This PR stops coercing non-string primitive inputs to strings
in Temporal methods, to avoid cases where numbers
are coerced to syntactically valid but often unexpected
string results.
2023-07-18 17:09:04 +02:00
Guillaume Emont 016e4bf8e8
Temporal Issue 2532 (#3858)
* Add tests for the new PrepareTemporalFields behavior for all direct callers

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

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDate

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalZonedDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalYearMonth

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalMonthDay

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToRelativeTemporalObject

* Add tests for the new PrepareTemporalFields behavior for indirect callers through AddDurationToOrSubtractDurationFromPlainYearMonth
2023-07-17 07:55:34 -07:00
Nicolò Ribaudo 7ef1833109 Move all tests using import assertions to files named as such 2023-07-17 16:32:25 +02:00
Frank Tang 9d7eb8018e Correct DurationFormat test
The expectation values for the formatToParts are incorrect.

A. The listFormat is consturcted with
  6. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
  so it should not have " and " in the string. Comparing with
  (new Intl.ListFormat("en", {type: "unit"})).formatToParts(["a", "b",
  "c"]) and
  value in the format d and the expected values in the
  DurationFormat/prototype/format directory
B. The localized unit values for "short" (and therefore default)
   are incorrect. Comparing with the expected values in the
  DurationFormat/prototype/format directory
2023-07-14 19:13:30 +02:00
Michael Ficarra 550c11163e
add tests for tc39/proposal-iterator-helpers#281 (#3869)
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2023-07-13 16:04:33 +02:00
Justin Grant 20e442011c Update temporalHelpers.js
* Fix SpecificOffsetTimeZone so that it correctly implements the time
  zone protocol. Previously, tests were passing but not actually
  exercising the expected codepaths.
* Add assertDateDuration function, which makes it shorter to assert
  durations that only contain date components.
2023-07-11 11:45:19 +02:00
André Bargull 8ce9864511 Add copy of transfer/transferToFixedLength tests with resizable-arraybuffer features removed 2023-07-03 15:10:04 +02:00
André Bargull 9ac846e0b9 Remove "resizable-arraybuffer" from ArrayBuffer transfer tests
Also adds missing "arraybuffer-transfer" feature flags.
2023-07-03 15:10:04 +02:00
Michael Dyck f5c932144a Delete trailing space after `|`
I'm not sure if YAML disallows it,
but test262 avoids it.
2023-06-29 14:08:47 +02:00
Ms2ger a85807714b Remove GraalJS from CI 2023-06-29 13:43:33 +02:00
Linus Groh d52a5bbbe8 Replace arrow function with regular function in harness/sta.js 2023-06-21 17:19:47 +02:00
Shu-yu Guo 2f0193d4cf Add missing iterator-helpers feature flag 2023-06-15 20:18:14 +02:00
Rick Waldron dfc7ce4c28
Iterator Helpers (#2818)
drop:

property descriptor
name
length
[[Prototype]]
is a function
is not constructible
result instanceof Iterator
limit is given a non-primitive that needs to be converted to a number
  through valueOf
  through toString (array)
limit coercion to number throws
limit converts to NaN
  same as limit not supplied
limit behaves properly
  limit < number of values
  limit = number of values
  limit > number of values
gets the next method from the underlying iterator only once
underlying iterator has throwing next getter
underlying iterator next throws when advancing past dropped items
underlying iterator is advanced after calling drop
underlying iterator is closed after calling drop
underlying iterator is already closed
underlying iterator next returns non-object
underlying iterator next returns object with throwing done/value getters
underlying iterator return is never called when result iterator is closed

every:

property descriptor
name
length
[[Prototype]]
is a function
is callable
is not constructible
result is a Boolean
predicate is non-callable
iterator already exhausted
called on non-object
called on object with "next" method
called on object with non-callable "next" method
predicate returns non-Boolean
predicate returns truthy for all iterated values
  returns true
predicate returns truthy for some iterated values but then falsey for at least one iterated value
  returns false
  iteration stops
  iterator is closed
predicate returns falsey immediately
  returns false
  iteration stops
  iterator is closed
predicate throws
  every throws
  iterator is closed
predicate throws then iterator close also throws
predicate this value is undefined
predicate is passed the yielded value as the first parameter and a counter as second parameter
gets the next method from the iterator only once
iterator has throwing next getter
iterator has throwing return getter
iterator next throws
iterator return throws
iterator next returns non-object
iterator next returns object with throwing done/value getters

Co-authored-by: Michael Ficarra <mficarra@shapesecurity.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-06-15 17:07:41 +02:00
Shu-yu Guo e337fc9506 Remove old Array group tests 2023-06-15 10:23:02 +02:00
Jordan Harband c5b24c64c3
groupBy: fix throwing iterator tests
Fixes #3852
2023-06-13 19:56:17 -07:00
Justin Grant 55658a4fa2 Work around Node 20 / ICU 73.1 calendar bug
These tests accompany a Temporal PR that works around a bug in
ICU 73.1 (which ships with Node 20). These test changes enable
tests to pass in both the buggy state and after the bug is eventually
fixed.
2023-06-12 12:39:52 +02:00
José Julián Espina c4642dd714
Fix phase on some module tests (#3832) 2023-06-11 00:12:02 +02:00
Philip Chimento aecd10eec8 Temporal helpers: format only ASCII identifiers specially
Using `\p{ID_Start}` and `\p{ID_Continue}` to match JS identifiers was not
supported everywhere. Let's assume that we only want to format ASCII
identifiers as bare property names. (This doesn't change any tests, just
the formatting of property names in lists of user-observable actions. No
tests currently checked for non-ASCII properties.)
2023-06-07 11:09:06 +02:00
André Bargull f4e31fc397 Update expected test results for CLDR 43
intl402/Locale/constructor-non-iana-canon.js
- Likely subtags entry for "hyw" -> "hyw-Armn-AM" was added to supplemental/likelySubtags.xml

intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js
- Likely subtags entry for "aae" -> "aae-Latn-IT" was added to supplemental/likelySubtags.xml
- Likely subtags entry for "pap" was changed from "pap_Latn_AW" to "pap_Latn_CW"
2023-05-31 09:26:12 -07:00
Philip Chimento 63e451dc80 Temporal: Tests for malicious time zones with zero-length days
Based on test cases provided by Anba in
https://github.com/tc39/proposal-temporal/issues/2333. (Thanks!)
2023-05-31 09:11:25 -07:00
Jordan Harband feb6f107f8 Convert Array.prototype.groupToMap tests to Map.groupBy tests 2023-05-31 08:32:28 -07:00
Jordan Harband 49237f30de Convert Array.prototype.group tests to Object.groupBy tests 2023-05-31 08:32:28 -07:00
Philip Chimento 3e858ef02d Tests for multiple calendar annotations with at least one critical
As per IETF review, an IXDTF string (ISO 8601 with annotations) is no
longer valid if it contains more than one u-ca annotation and at least one
of the annotations is marked critical.

Removes tests where such a string was assumed to be valid, and adds new
ones with a few variations on invalid strings.
2023-05-24 13:12:40 -07:00
Veera 88a2f0dcd1 Fix copyright 2023-05-18 11:19:31 -07:00
Veera 732cfff666 Fix YAML indentation 2023-05-18 11:19:31 -07:00
Veera bf337727a0 Try to fix CI errors 2023-05-18 11:19:31 -07:00
Veera 377231a1de Add tests for increment and decrement operations on `this` 2023-05-18 11:19:31 -07:00
Jordan Harband 4fc741b008
Merge pull request #3820 from mathiasbynens/unicodeSets-breaking-changes-from-u-to-v
Add tests for RegExp `v` flag errors that were allowed with `u`
2023-05-01 23:39:03 -07:00
Mathias Bynens 1010e63caf Add tests for RegExp `v` flag errors that were allowed with `u`
https://github.com/tc39/proposal-regexp-v-flag#how-is-the-v-flag-different-from-the-u-flag

Issue: #3496
Issue: https://github.com/tc39/proposal-regexp-v-flag/issues/52
2023-05-01 23:34:57 -07:00
Guillaume Emont 72c0c5e163 Added new tests to reflect the change that daysInMonth is the count of days in a month
This change affects how PlainYearMonth's add and subtract behave. They
now ignore daysInMonth reimplementations in the calendar, and they call
dateadd() a different number of times.

See https://github.com/tc39/proposal-temporal/issues/1315
2023-04-28 12:16:41 -07:00
Guillaume Emont d7fa398364 Updated tests to reflect that daysInMonth are the count of days in a month
See https://github.com/tc39/proposal-temporal/issues/1315
2023-04-28 12:16:41 -07:00
Mathias Bynens 1a352aac50 Avoid excessive `U+` in error messages 2023-04-28 11:43:01 +02:00
Philip Chimento 63e0986803 Improve printing of property key names in observer helpers
These should be formatted in the same way that they'd be entered in source
code.
2023-04-24 12:14:18 +02:00
Philip Chimento dd47e4e248 Improve comments and assertion messages 2023-04-24 12:14:18 +02:00
Philip Chimento c03a58ba35 Temporal: More baseline order-of-operations tests
Add order-of-operations tests for:

- Temporal.ZonedDateTime.p.getISOFields()
- Temporal.ZonedDateTime.p.round()
- years with ZonedDateTime relativeTo in Temporal.Duration.p.round()
- years with ZonedDateTime relativeTo in Temporal.Duration.p.total()
- property Gets on receiver in Temporal.PlainDateTime.p.with()
- ZonedDateTime difference methods with largestUnit being a time unit
- Duration.compare with no units higher than hours
2023-04-24 12:14:18 +02:00
Philip Chimento 56fe761577 Temporal: Fix .slice() in test leftover from debugging
I had been using slice() here to cut down the list of operations to
compare during debugging, but accidentally left it in.
2023-04-24 12:14:18 +02:00
Aditi 2df6c7d29a Added test for non-iso calendars for Temporal.PlainMonthDay.from 2023-04-18 12:09:26 -07:00
Anthony Frehner e5a7450095 Remove backtick from CONTRIBUTING.md 2023-04-11 15:18:17 -07:00
Philip Chimento 801a5bb8f5 Temporal: Port toLocaleString calendar mismatch tests from staging
I wrote a similar test for Temporal.ZonedDateTime.p.toLocaleString, so
while this was fresh I decided to do the same for the other toLocaleString
calendar mismatch tests that were in staging.
2023-04-11 11:52:40 +02:00
Philip Chimento cd714a9aad Temporal: Rewrite Temporal.ZonedDateTime.p.toLocaleString tests
In https://github.com/tc39/proposal-temporal/pull/2522 which reached
consensus at the March 2023 TC39 meeting, the functionality of
Temporal.ZonedDateTime.p.toLocaleString was changed substantially, to not
directly pass the ZonedDateTime to any Intl.DateTimeFormat methods. This
adds rewrites of all existing tests for toLocaleString, as well as a few
tests to verify that Intl.DateTimeFormat methods no longer support
Temporal.ZonedDateTime arguments.

As we are rewriting the tests anyway, this also ports all of the
Temporal.ZonedDateTime.p.toLocaleString tests that were in staging, to the
correct format for the main tree.
2023-04-11 11:52:40 +02:00
Guillaume Emont da56f5e2b2 Temporal: updates tests for balancing ordering change in Temporal.Duration.prototype.round
Fixes some tests which are observing side effects of round().
2023-04-10 12:50:11 -07:00
Guillaume Emont 13778441ad Temporal: added a test reproducing tc39/proposal-temporal#2508
Before the issue is fixed, rounding a duration such as 'PT2400h' with
months as largest unit fails to balance it properly and gives a result
with days being the largest unit. The test ensures that such rounding
happens properly.
2023-04-10 12:50:11 -07:00
Philip Chimento 6d0978de60 Tweak test descriptions: "Intl time zones" → "IANA time zones"
Suggestion from Justin Grant's code review.
2023-04-10 08:36:08 -07:00
Philip Chimento 33865c5339 Validate required methods of Temporal Calendar protocol
Checking whether an object implements the Calendar protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the Calendar brand.

Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00