Commit Graph

5656 Commits

Author SHA1 Message Date
Frank Yung-Fong Tang bc4af482b0 Fix features by removing leading space 2022-03-09 15:24:33 -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
Jesse Alama 131c396b6a Remove number test (yields a different error, not an exception) 2022-02-28 14:37:03 -05:00
Jesse Alama 8ff1e510b9 Add a couple more types 2022-02-28 14:37:03 -05:00
Jesse Alama 9c6e3aff38 Move to more sensible location 2022-02-28 14:37:03 -05:00
Jesse Alama 10f9a69295 Move test to a more sensible location
Also, use a more sensible ID as well. Add another test (for
Date values).
2022-02-28 14:37:03 -05:00
Jesse Alama ecd24faa82 Fix buggy error message 2022-02-28 14:37:03 -05:00
Jesse Alama 918cefcd09 Check `formatRange` on many pairs of invalid arguments 2022-02-28 14:37:03 -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
Philip Chimento 615a2eb9a1 Fix tests for private reference with logical assignment
There were three things wrong with the 'and', 'or', and 'nullish' tests
that I added as part of #2940:

1. They were in the wrong folder (should be
   expressions/logical-assignment, not expressions/compound-assignment)
2. The tests for ||= and ??= on readonly accessor properties were
   incorrect. These assignments would short-circuit if the getter
   returned 1 as it previously did, so PutValue would not throw.
3. The tests for ||= and ??= on private methods were invalid, as a
   method always evaluates to true in a boolean context, and is not
   nullish, so these would always short-circuit.

I've removed the invalid private method cases, fixed the readonly
accessor cases, and added new templates to test the short-circuit
behaviour as well as the non-short-circuit behaviour.

Closes: #3413
2022-02-21 15:38:59 -05:00
legendecas ec39db5877 Test array grouping Symbol.unscopables values 2022-02-16 09:57:44 -05:00
Philip Chimento 1b1097dbf6 Add tests for compound assignment to private reference
This tests compound assignment, with each compound assignment operator,
to each kind of private reference (private field, private accessor
property with getter and setter, private accessor property with only
getter, and private method). The latter two cannot be assigned to and
therefore throw.

Closes: #2940
2022-02-16 09:56:59 -05:00
Philip Chimento 0b0fbdb04b Fix path example in generated test instructions
We should not have an absolute path (starting with a slash) in this
field, because that will mess up the test generation program.
2022-02-16 09:56:59 -05:00
Philip Chimento 08937278f1 Add .case and .template files to .editorconfig
Without this, my editor thinks they should be 4-space tabbed files, but
they should be treated the same as other files containing JavaScript.
2022-02-16 09:56:59 -05:00
Ms2ger 0370240141 Port tests for PlainTime. 2022-02-16 09:39:30 -05:00
Jesse Alama 8851f084b6 Use ECMAScript 6 2022-02-11 10:42:35 -05:00
Ms2ger df873eed1a Port tests for PlainYearMonth#{add,subtract}. 2022-02-08 15:46:11 -05:00
Alexey Shvayka 5cc9a6bda6 Add Array.prototype.unshift() tests 2022-02-08 15:45:38 -05:00
Alexey Shvayka 37ffcfb7ed Add Array.prototype.shift() tests 2022-02-08 15:45:38 -05:00
Alexey Shvayka 1323cc3152 Add Array.prototype.push() tests 2022-02-08 15:45:38 -05:00
Alexey Shvayka 014ca9fcc3 Add Array.prototype.pop() tests 2022-02-08 15:45:38 -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
legendecas 281c781ee4
Fix WrappedFunction throwing tests (#3396)
Also adds more non-string cases for copy name
2022-02-04 15:08:14 -08:00
Linus Groh b3774e9593
Add missing propertyHelper.js include to WrappedFunction tests (#3399) 2022-02-04 15:07:55 -08:00
legendecas d5d9f66a8f Test WrappedFunction properties 2022-02-03 13:53:24 -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