Commit Graph

190 Commits

Author SHA1 Message Date
Mike Pennisi 396fc064d8 fixup! Add tests for "Intl NumberFormat v3" proposal 2021-11-01 12:50:38 -04:00
Mike Pennisi c0ea82adf1 fixup! Add tests for "Intl NumberFormat v3" proposal 2021-11-01 12:50:38 -04:00
Mike Pennisi 057c8acec7 Add tests for "Intl NumberFormat v3" proposal
This patch is intended to cover only one aspect of the proposal for
ECMA402: the "rounding mode" feature.
2021-11-01 12:50:38 -04:00
Mike Pennisi f527a107f2 Relax tests for resolvedOptions property ordering
A number of tests for ECMA402 asserted the exact contents of the array
returned by various `resolvedOptions` methods. This conflicted with the
expectation that more options will be introduced by future editions of
the specification.

Update these tests to assert property order more generically in order to
accommodate implementation of future language proposals and more closely
align with similar tests.

Update all `resolvedOptions` tests to produce more meaningful error
messages (including replacing the generic `arrayContains` assertion with
a specific assertion regarding the value of the first array element).
2021-10-29 15:19:27 -04:00
Mike Pennisi 1ad9bb7626 Improve errors in NumberFormat#formatToParts tests
Specify a descriptive value for the previously-unused third parameter of
the `verifyFormatParts` function in order to disambiguate error
messages.

This patch was generated with the following command:

    sed -i 's/\(verifyFormatParts([^,]\+, \)\([^,]\+\))/\1\2, "\2")/g' \
      test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-*
2021-10-18 09:45:11 -04:00
Mike Pennisi 7ce15a19f3 Correct test descriptions 2021-10-18 09:44:53 -04:00
André Bargull 71460edfeb Add helper functions to retrieve all calendars, collations, numberingSystems, and simple sanctioned units
And then use these helpers to replace hard-coded lists in other tests.
2021-09-08 09:29:06 -04:00
Ujjwal Sharma 76ab0187c0 Add NumberFormat tests for OrdinaryHasInstance
Add tests to make sure NumberFormat does not call the instanceof
operator and calls OrdinaryHasInstance instead.

Refs: https://github.com/tc39/ecma402/pull/500
2021-02-16 12:20:50 -05:00
ExE Boss 8f904d8cc8 Set function `length` and `name` in `CreateBuiltinFunction` 2021-01-29 09:45:20 -05:00
Rick Waldron 82f38efbab Features: add "intl-normative-optional" 2020-11-03 14:28:17 -05:00
Yusuke Suzuki 20b11bee0f Add tests for [[Description]] of Intl [[FallbackSymbol]]
If normative optional is implemented and [[FallbackSymbol]] is used, its description should be "IntlLegacyConstructedSymbol"
2020-11-02 12:34:09 -05:00
Yusuke Suzuki 3c789640ec dft-currency-mnfd-range-check-mxfd.js should check maximumFractionDigits, not maximumSignificantDigits
This test is checking maximumSignificantDigits, but this is wrong. We should check maximumFractionDigits.
2020-09-28 09:09:09 -04:00
Yusuke Suzuki 3fe45c44c6 Revert "Intl.NumberFormat + currency will throw an error if maximumFractionDigits is less than currencyDigits"
This reverts commit a7b9067fe1.
I fixed the test with a7b9067fe1 based on the current spec, but this test was based on WIP spec change.
2020-09-24 14:55:28 -04:00
Yusuke Suzuki a7b9067fe1 Intl.NumberFormat + currency will throw an error if maximumFractionDigits is less than currencyDigits
In 12.1.1 SetNumberFormatDigitOptions step 12.d[1], mnfd (minimum fraction digits) becomes the same to currencyDigits (mxfdDefault in this case).
It is 2 for USD, 4 for CLF. So, if maximumFractionDigits is less than that, we should throw RangeError.

[1]: https://tc39.es/ecma402/#sec-setnfdigitoptions
2020-09-15 10:33:23 -04:00
Rick Waldron 873a7241c3 Fixup Intl.* this-value tests (delete dups, add proper esid) 2020-09-14 13:35:13 -04:00
Frank Tang ab3a86d9b3 Move tests from
https://source.chromium.org/chromium/chromium/src/+/master:v8/test/test262/local-tests/
2020-09-14 13:35:13 -04:00
Ujjwal Sharma 6c3f8cdc75
Update tests for tc39/ecma402#471 (#2707) 2020-08-13 10:31:24 -07:00
André Bargull 649d0d2c9a Update list of non-algorithmic numbering systems
Per https://github.com/tc39/ecma402/pull/438
2020-06-24 12:11:36 -04:00
André Bargull 630f7dee66 Updated expected error in NumberFormat constructor per current spec 2020-06-24 12:11:36 -04:00
Alexey Shvayka ef12a8b11c
Intl: Add coverage for meaningful @@toStringTag values (#2634)
* Add Intl.Collator tests

* Add Intl.DateTimeFormat tests

* Adjust Intl.NumberFormat tests

* Add Intl.PluralRules tests

* Remove now duplicated tests

* Add "toString-changed-tag.js" tests
2020-06-01 15:40:35 -07:00
Frank Yung-Fong Tang 064d3c24e3 correct exceptions for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 18f55513f0 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 7bb81a4ee0 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 52ec5850d6 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 6b3b5c100a correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 7aa12918ec correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang fb00de47c0 correct expectation of exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 11cc0c03f9 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 9119877088 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 2022f97a25 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 0fc6784390 correct exceptZero expectation 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 988bf55b25 correct exceptZero expectation 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang e5d4129d37 correct for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 8293c961e9 correct expectation for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 0279d96432 correct cases for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang d4017357d8 correction for exceptZero 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang f07fe8cb1c correct 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang c1a1111972 correct 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 832ecd285f correct 2020-04-23 10:46:27 -04:00
Frank Yung-Fong Tang 940be668ca correct expectation for signDisplay: "exceptZero" 2020-04-23 10:46:27 -04:00
André Bargull ae8694b4b7 Copy "invalid options" test from RelativeTimeFormat to NumberFormat/DateTimeFormat
The invalid 'numberingSystem' options test from RelativeTimeFormat covers a few
more cases, so let's reuse it for NumberFormat and DateTimeFormat.
While there, also add tests using non-ASCII inputs.

Fixes #2540
2020-03-30 13:58:04 -04:00
Caio Lima 5d5904d69a Adding test cases to verify that 'numberingSystem' and 'calendar' options are being mapped to lower case 2020-02-20 12:33:21 -05:00
Ms2ger 1f7f5ef23c Change the unit in the NumberFormat unit tests.
This ensures https://github.com/tc39/proposal-unified-intl-numberformat/pull/93 is covered.
2020-02-06 11:09:18 -05:00
Caio Lima 04b1d2254b Added tests with invalid values for calendar and numberingSystem (#2480) 2020-01-24 14:21:33 -05:00
Lo̹̫̦̥̬̜͈͝n̗͚̼̤ĝ̮̫͎̬̬͕̪ͫ̐̕ ͭ̊H̱̏ͬ̃ͨ̆͗o̱͚͉͉̖̰̪ͯ̈ͪ̈̎̚ cd6db88295 Fix toNumber consistency issue with boolean (#2456)
As per https://tc39.es/ecma262/#table-11 `toNumber(false)` is supposed to be `+0`
2020-01-08 16:24:19 -05:00
Ms2ger 2fb0eca404 More tests for Unified NumberFormat. (#2454) 2020-01-08 16:23:01 -05:00
Leo Balter 2b48ec7a00 More yaml and whitespace fixes
Ref #2383
2019-10-08 14:50:57 -04:00
Frank Yung-Fong Tang 79a01f5122 Add tests for 'numberingSystem' and 'calendar' options (#2383)
* Add tests for 'numberingSystem' option

* add constructor-numberingSystem-order.js

* correct esid

* initial actual

* add let

* add constructor-calendar-numberingSystem-order.js
2019-10-08 14:48:46 -04:00
Mike Pennisi f26c2a11bd Remove unnecessary "includes" directives
The values defined by the referenced files are not used by these tests.
This makes their inclusion superfluous, which needlessly increases the
time to execute the tests and may confuse some readers.
2019-09-25 13:59:24 -04:00
Alexey Shvayka ef7fd2bc27 Add "proto-from-ctor-realm" tests for Intl constructors (#2334)
* Rename "Object/proto-from-ctor.js" test

* Add missing "Symbol" features

* Add Intl.Collator test

* Add Intl.DateTimeFormat test

* Add Intl.NumberFormat test

* Add Intl.PluralRules test
2019-09-11 17:22:21 -03:00
André Bargull 59a1a016b7 Assign "name" property to all anonymous functions (#2299)
Implements the changes from <https://github.com/tc39/ecma262/pull/1490>.
2019-08-15 10:58:40 -04:00
Ms2ger 70a07985a5 Unified Intl.NumberFormat: Various tests (#2275)
* Unified Intl.NumberFormat: Test compact notation with various locales.

* Unified Intl.NumberFormat: Test compactDisplay constructor option.

* Unified Intl.NumberFormat: Test signDisplay constructor option.

* Unified Intl.NumberFormat: Test signDisplay with various locales.

* Unified Intl.NumberFormat: Test signDisplay with accounting currencySign in various locales.

* Unified Intl.NumberFormat: Test engineering and scientific notations in various locales.

* Unified Intl.NumberFormat: Test unit handling.

* Unified Intl.NumberFormat: Test notation constructor option.

* Unified Intl.NumberFormat: Test engineering and scientific notations with negative exponents.

* Unified Intl.NumberFormat: Test near-zero arguments with signDisplay.

* Unified Intl.NumberFormat: Test units.

* Unified Intl.NumberFormat: Test unit arguments.

* Unified Intl.NumberFormat: Add a generic test for unit arguments.

* Unified Intl.NumberFormat: Test the unitDisplay argument.
2019-08-14 12:47:05 -04:00
André Bargull 8b725e3957 Updates test for Intl.NumberFormat Unified API Proposal changes. 2019-07-22 02:12:27 -07:00
Frank Yung-Fong Tang dce0910981 change to camelCase to sync with #54 (#2240)
to sync with https://github.com/tc39/proposal-unified-intl-numberformat/pull/54
@sffc @leobalter
2019-07-16 19:00:29 -04:00
Frank Yung-Fong Tang f7a3f63270 remove (min|max)imumFractionDigits w/ significant (#2189)
Per change in https://tc39.github.io/proposal-unified-intl-numberformat/section11/numberformat_diff_out.html
we should not output minimumFractionDigits and maximumFractionDigits if minimumSignificantDigits or maximumSignificantDigits are set.
2019-06-05 04:08:54 -04:00
Daniel Ehrenberg 80af423aca intl tests for proposed additional options in options bag (#1225)
This patch implements tests for the ECMA 402 PR at
https://github.com/tc39/ecma402/pull/175

It is based on the test test/intl402/Collator/10.1.1_19_c.js
2019-05-16 13:46:08 -04:00
Frank Yung-Fong Tang 9b0d09eb11
change the removed unit 'generic' to 'gigabit' 2019-05-15 22:14:13 -07:00
Frank Yung-Fong Tang 6da911b9f2 Fix the rounding issue (#2027) 2019-01-28 11:52:50 -05:00
Frank Yung-Fong Tang e0a07bc650 Correct the expectation for format-fraction-digits-precision (#2025) 2019-01-28 11:42:22 -05:00
André Bargull b62dae4fff Fix various bugs in test cases (#1988) 2018-12-05 15:48:28 -05:00
Ms2ger d857bd6f72 Unified Intl.NumberFormat: Add some initial tests for SetNumberFormatUnitOptions. 2018-11-28 10:25:18 -05:00
Ms2ger fa16d7df3f Intl: Add tests for table iteration order.
The order was defined in <https://github.com/tc39/ecma402/pull/279>.
2018-10-17 12:59:38 -04:00
André Bargull d3e5b818d9 Revert "remove "invalid" from invalid date of "cu" and "nu""
This reverts commit a1c3929c35.
2018-10-17 07:46:46 -07:00
André Bargull faed4fb089 Fix various test issues 2018-10-17 07:45:33 -07:00
Ujjwal Sharma 9dc33cc5b4 intl: fix mistyped test for array-like objects 2018-10-15 12:54:05 -04:00
Ujjwal Sharma f8e3a8ed11 Add let before variable declaration 2018-10-05 15:32:54 -04:00
Ujjwal Sharma ec35b59e88 intl: increase coverage for the NumberFormat constructor
Increase the coverage for the constructor for Intl.NumberFormat by
ensuring that HasProperty(O, Pk) is properly called.
2018-10-05 15:32:54 -04:00
Ujjwal Sharma f8e0bf6751 intl: fix dicey test case 2018-10-04 14:30:22 -04:00
Ujjwal Sharma ff8b10c448 intl: increase coverage for the Intl.NumberFormat constructor
Increase coverge for the Intl.NumberFormat constructor by testing that
Get(O, P) and ToString(arg) are properly called.
2018-10-03 17:32:33 -04:00
Frank Tang a1c3929c35 remove "invalid" from invalid date of "cu" and "nu" 2018-10-03 13:22:29 -04:00
Ujjwal Sharma 041d5acd5e Update test to actually check properties 2018-10-03 13:13:58 -04:00
Ujjwal Sharma de416c28c3 intl: increase coverage from the NumberFormat constructor
Improve coverage for the Intl.NumberFormat constructor by testing that
it accepts Array-like objects and handles them properly.
2018-10-03 13:13:58 -04:00
Ujjwal Sharma cd55e30938 Update test to actually check properties 2018-10-03 11:07:06 -04:00
Ujjwal Sharma af0f53bb40 intl: increase coverage for the NumberFormat constructor
Increase coverage for the Intl.NumberFormat constructor by testing that
passing a string value to the Intl.NumberFormat constructor is
equivalent to passing an Array containing the same string value.
2018-10-03 11:07:06 -04:00
Rick Waldron 0ead0130ea Intl.NumberFormat: cannot use assert.sameValue to compare object references. 2018-10-02 15:03:52 -04:00
Ujjwal Sharma bba2429cad intl: increase coverage for NumberFormat constructor
Increase coverage for the Intl.NumberFormat constructor by adding tests
checking if appropriate default values are used.
2018-10-02 14:51:22 -04:00
Ujjwal Sharma e9946587b9 Update test to include object and symbol 2018-10-02 14:49:00 -04:00
Ujjwal Sharma bb7585bdaf intl: increase coverage for NumberFormat constructor
Increase coverage for the Intl.NumberFormat class contructor by adding
tests for checking that it calls ToObject on the options argument.
2018-10-02 14:49:00 -04:00
Ujjwal Sharma 24386286f1 Update filenames and fix failures 2018-10-02 14:48:37 -04:00
Ujjwal Sharma 2ecd230b63 Update test to include object and symbol 2018-10-02 14:48:37 -04:00
Ujjwal Sharma 5fe9773f44 intl: increase coverage for NumberFormat constructor
Increase coverage for the Intl.NumberFormat class contructor by adding
tests for checking that it calls ToObject on the locales argument.
2018-10-02 14:48:37 -04:00
Ujjwal Sharma 5fae9deb1f intl: rework Intl.NumberFormat.prototype.formatToParts tests
Rework the available tests for Intl.NumberFormat.prototype.formatToParts
to improve consistency and readability.
2018-09-27 11:03:16 -04:00
Ujjwal Sharma 41bf0ee344 intl: add assertion to test that the result for default parameter
Add an assertion to the test for default parameters in Intl.NumberFormat's
method formatToParts checking that both the values are equal to the correct
result.
2018-09-27 11:00:55 -04:00
André Bargull 3a1bcae4d1 Expect leading sign when the input is negative zero 2018-09-26 10:38:35 -04:00
André Bargull d9f67d53d1 Move the extra precision tests into separate files
This will allow implementations to test the rest of the number formatting tests,
even if the extra precision support isn't implemented.
2018-09-26 10:38:35 -04:00
André Bargull 4bc96880a1 Add missing explicit ToString conversion for symbol values and ensure the expected NaN result is a (locale-dependent) string 2018-09-26 10:38:35 -04:00
Ujjwal Sharma cdd91e2895 Improve ToNumber test for NumberFormat.format 2018-09-20 17:25:14 -04:00
Ujjwal Sharma 7a87bde265 intl: increase coverage for NumberFormat.format
Increase test coverage for Intl.NumberFormat.prototype.format by adding
a check for testing if it calls ToNumber (7.1.3) on its argument.
2018-09-20 17:25:14 -04:00
Ujjwal Sharma a6412918d2 Simplify default value check of NumberFormat.format 2018-09-19 15:23:30 -04:00
Ujjwal Sharma cbfa2c5f00 intl: increase coverage for NumberFormat
Increase coverage for Intl.NumberFormat by adding a test for format
checking it's default value.
2018-09-19 15:23:30 -04:00
Ujjwal Sharma 94cb047ab8 Update assert failure messages 2018-09-18 14:55:11 -04:00
Ujjwal Sharma 0c89259da5 intl: refactor tests for NumberFormat 2018-09-18 14:55:11 -04:00
Ujjwal Sharma fec7982e09 Update test case description 2018-09-18 11:42:59 -04:00
Ujjwal Sharma 490f911ab6 Refactor value check for prop-desc 2018-09-18 11:42:59 -04:00
Ujjwal Sharma 24c29db550 Rename initial-value to configurable and add initial check to prop-desc 2018-09-18 11:42:59 -04:00
Ujjwal Sharma e566c813b5 Add additional initial value tests 2018-09-18 11:42:59 -04:00
Ujjwal Sharma c129ac8546 intl: improve coverage for Intl.NumberFormat
Add tests for Intl.NumberFormat.prototype[@@toStringTag].
2018-09-18 11:42:59 -04:00
Ms2ger 9271068a83 Intl: Add tests for throwing getters in options objects. 2018-09-18 11:39:47 -04:00
Ujjwal Sharma 12055caa1c Add symbol to list of invalid targets 2018-09-17 15:59:58 -04:00
Ujjwal Sharma db238a1abe intl: improve coverage for Intl.NumberFormat
Add Intl.NumberFormat.prototype.formatToParts to the test
this-value-not-numberformat.js to check if a TypeError is thrown if the
"this" value for the function call isn't a valid NumberFormat object.
2018-09-17 15:59:58 -04:00