Commit Graph

5571 Commits

Author SHA1 Message Date
Frank Yung-Fong Tang 16f3f494d3 fix test
1. "–" => " – "
2. Move the verifyProperty after assert.sameValue because it has side effect of removing that property while it is writable.
2022-01-07 13:20:17 -05:00
Frank Yung-Fong Tang b91167622b add includes: [propertyHelper.js] 2022-01-07 13:20:17 -05:00
Frank Yung-Fong Tang 0b8efb9c0d correct expectation 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a12f375a99 remove extra "Digits" 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang fe9f29e4a8 Fix format-rounding-priority-less-precision.js
1. remove extra "Digits" in the spelling
2. fix the setting of minimumSignificantDigits is more precise since both will produce "1.00" w/o change
2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a665b5f3a2 fix case for roudingIncrement: 5000 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 4cc44841f6 fix test for roundingIncrement: 500 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 5ee4e0d609 change to minimumFractionDigits:1 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a8e89964b4 set minimumFractionDigits: 1 to testing of 250 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 2d52f74d97 set minimumFractionDigits: 1 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 4719c8c2dd adjuest setting for roundingIncrement: 25 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 9e50891a40 set minimumFractionDigits: 1 in format-rounding-increment-5
We need to set minimumFractionDigits: 1 for the case of {roundingIncrement: 5, maximumFractionDigits: 1} and also adjust the test expectation. 
Otherwise, inside testNumberFormat , it will call   getPatternParts to format 1.1 and -1.1 and cause pattern mismatch (because the result will be "1" instead of "1.1" in that configuration)

https://github.com/tc39/test262/blob/main/harness/testIntl.js#L2369
2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 63f2c5b10f Remove 1.1 case which should NOT throw RangeError
roundingIncrement: 1.1 will not throw RangeError because
1.  roundingIncrement is read by calling GetNumberOption 
2. GetNumberOption https://tc39.es/ecma402/#sec-getnumberoption will call DefaultNumberOption https://tc39.es/ecma402/#sec-defaultnumberoption and 
3. DefaultNumberOption will call floor() in step 3.
2022-01-07 13:18:18 -05:00
Frank Yung-Fong Tang 0fe508c5f0 change notation to "standard"
I do not believe this setup is correct if we use notation: "compact". 

in https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/diff.html#sec-setnfdigitoptions
notation is "compact"
mnsd is undefined
mxsd is undefined
mnfd is undefined
mxfd is undefined
hasSd is false
hasFd is false
needSd is false
needFd is false
so step 23 else block will be run
Set intlObj.[[RoundingType]] to morePrecision.
then in step 23 of https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/diff.html#sec-initializenumberformat
```
If roundingIncrement is not 1 and numberFormat.[[RoundingType]] is not fractionDigits, throw a RangeError exception.
```
2022-01-07 13:17:50 -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
Csaba Osztrogonác bd1acb51a4 tools: enforce restriction on YAML includes key
Includes key should use flow notation to be able parsed easier
as suggested in https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-05 17:27:58 -05:00
Mathias Bynens f864edbc1c Add identifier tests for private class fields specifically
@bathos discovered that multiple engines implement this incorrectly:
https://twitter.com/bhathos/status/1478370049303928832

With that in mind, it’s probably worth adding some test coverage.
Test generator patch: https://github.com/mathiasbynens/caniunicode/pull/6
2022-01-05 14:24:20 -05:00
Mike Pennisi 6c9b4de507 fixup! Add tests for "Intl NumberFormat v3" proposal 2022-01-04 09:35:13 -05:00
Mike Pennisi d071b37f09 Add tests for "Intl NumberFormat v3" proposal
This patch is intended to cover only one aspect of the proposal for
ECMA402: the "new rounding/precision options" feature.
2022-01-04 09:35:13 -05:00
Yusuke Suzuki 6804e59f9f Fix Intl.PluralRules.selectRange test
en-US's Intl.PluralRules.selectRange(102, 201) is "other", not "few".
2022-01-04 09:33:18 -05:00
Kevin Gibbons 56a4cab76c Add tests: order of coercion of arguments vs NaN check in Date methods 2022-01-04 09:32:53 -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
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
Mike Pennisi 08a9fc2b97 Fix: correct Resizable ArrayBuffer/Array tests
Prior to this patch, the tests for certain Array prototype methods
incorrectly expected all elements to be "visited" even when a given
property was not present according to HasProperty.

Update the tests to reflect the fact that under such conditions, the
removed element is not visited.
2021-12-18 11:50:47 -05:00
Mike Pennisi c51227c3e1 Add tests: resizing ArrayBuffer from DataView ctor 2021-12-18 11:50:14 -05:00
Romulo Cintra 46f847c2e8
NumberFormat v3 tests (#3283)
* feat: nfv3 plural rules

* test NaN and out of range values

* add NumberFormat v3 proposal features

* add feature to selectrange tests

* add basic test NumberFormat.formatRange

* add basic test NumberFormat.formatRangeToParts

* update Plural Rules tests

* refactor some tests

* update formatRange tests

* update formatRangeToParts tests

* update feature flag

* add locale: [en-US]

* update selectRange tests

* update tests

* update en-US tests and add pt-PT

* update prop-desc check

* validate  1.1.25_4.a

Co-authored-by: Romulo Cintra <romulocintra@gmqil.com>
2021-12-17 14:33:27 -05:00
legendecas 10bfc6c9d2 Revert removal of module flag in ShadowRealm.prototype.importValue tests 2021-12-15 12:33:42 -05:00
legendecas 5074a087e8 fixup! add module flags 2021-12-15 12:32:16 -05:00
legendecas 49b14b577b fixup! 2021-12-15 12:32:16 -05:00
legendecas 2000e858ff Add coverage on ShadowRealm.prototype.importValue onRejected 2021-12-15 12:32:16 -05:00
Joseph Griego 04cd6da021 Add test for shadow realms wrapped function behavior on throw 2021-12-14 14:17:18 -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 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 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
Mike Pennisi 6d5975defc Remove duplicated constructor tests
A number of tests were found to be duplicative based on an analysis of
file contents (included below). Eliminate the duplication by removing
the version of each test with less precise metadata. In cases where this
removal could technically be considered a reduction in coverage,
preserve the verification of additional semantics in the remaining test.

    $ git grep -El 'new\s+\w+.prototype' | sed 's/[^\/]\+$//g' | sort | uniq -c | grep -vE '^\s+1 ' | awk '{print $2}' | xargs grep -Elr 'new\s+\w+.prototype'
    test/built-ins/Array/prototype/join/S15.4.4.5_A6.7.js
    test/built-ins/Array/prototype/join/not-a-constructor.js
    test/built-ins/Array/prototype/pop/not-a-constructor.js
    test/built-ins/Array/prototype/pop/S15.4.4.6_A5.7.js
    test/built-ins/Array/prototype/push/S15.4.4.7_A6.7.js
    test/built-ins/Array/prototype/push/not-a-constructor.js
    test/built-ins/Array/prototype/shift/not-a-constructor.js
    test/built-ins/Array/prototype/shift/S15.4.4.9_A5.7.js
    test/built-ins/Array/prototype/slice/not-a-constructor.js
    test/built-ins/Array/prototype/slice/S15.4.4.10_A5.7.js
    test/built-ins/Array/prototype/sort/not-a-constructor.js
    test/built-ins/Array/prototype/sort/S15.4.4.11_A7.7.js
    test/built-ins/Array/prototype/splice/S15.4.4.12_A5.7.js
    test/built-ins/Array/prototype/splice/not-a-constructor.js
    test/built-ins/Array/prototype/toLocaleString/S15.4.4.3_A4.7.js
    test/built-ins/Array/prototype/toLocaleString/not-a-constructor.js
    test/built-ins/Array/prototype/toString/S15.4.4.2_A4.7.js
    test/built-ins/Array/prototype/toString/not-a-constructor.js
    test/built-ins/Array/prototype/unshift/S15.4.4.13_A5.7.js
    test/built-ins/Array/prototype/unshift/not-a-constructor.js
    test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T1.js
    test/built-ins/Function/prototype/apply/S15.3.4.3_A8_T2.js
    test/built-ins/Function/prototype/apply/not-a-constructor.js
    test/built-ins/Function/prototype/call/not-a-constructor.js
    test/built-ins/Function/prototype/call/S15.3.4.4_A7_T2.js
    test/built-ins/Function/prototype/call/S15.3.4.4_A7_T1.js
    test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js
    test/built-ins/Function/prototype/toString/not-a-constructor.js
    test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js
    test/built-ins/Object/prototype/hasOwnProperty/not-a-constructor.js
    test/built-ins/Object/prototype/propertyIsEnumerable/not-a-constructor.js
    test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js
    test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js
    test/built-ins/Object/prototype/toLocaleString/not-a-constructor.js
    test/built-ins/Object/prototype/toString/not-a-constructor.js
    test/built-ins/Object/prototype/toString/not-ctor.js
    test/built-ins/Object/prototype/valueOf/not-a-constructor.js
    test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
2021-12-14 13:38:51 -05:00
Justin Grant 6c2884eb9e Verify that `Temporal.*.prototype` isn't writeable 2021-12-14 13:38:14 -05:00
Frank Yung-Fong Tang 29a0a1e253 Simplify the testing
The last five lines below are simply WRONG and not according to the spec. 

```
const durationFormat = new Intl.DurationFormat();

verifyNotEnumerable(durationFormat, Symbol.toStringTag);
verifyNotWritable(durationFormat, Symbol.toStringTag);
verifyConfigurable(durationFormat, Symbol.toStringTag);
```
2021-12-14 13:37:35 -05:00