diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js')
-rw-r--r-- | js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js b/js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js new file mode 100644 index 0000000000..b9a27c9490 --- /dev/null +++ b/js/src/tests/test262/intl402/NumberFormat/test-option-useGrouping-extended.js @@ -0,0 +1,42 @@ +// |reftest| skip-if(release_or_beta) -- Intl.NumberFormat-v3 is not released yet +// Copyright 2021 the V8 project authors. All rights reserved. +// Copyright 2022 Apple Inc. All rights reserved. +// Copyright 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializenumberformat +description: Tests that the option useGrouping is processed correctly. +info: | + The "Intl.NumberFormat v3" proposal contradicts the behavior required by the + latest revision of ECMA402. +features: [Intl.NumberFormat-v3] +---*/ + +function render(options) { + var nf = new Intl.NumberFormat(undefined, options); + return nf.resolvedOptions().useGrouping; +} + +assert.sameValue(render({}), 'auto', '(omitted)'); +assert.sameValue(render({useGrouping: undefined}), 'auto', 'undefined'); +assert.sameValue(render({useGrouping: 'auto'}), 'auto', '"auto"'); +assert.sameValue(render({useGrouping: true}), 'always', 'true'); +assert.sameValue(render({useGrouping: 'always'}), 'always', '"always"'); +assert.sameValue(render({useGrouping: false}), false, 'false'); +assert.sameValue(render({useGrouping: null}), false, 'null'); +assert.sameValue(render({useGrouping: 'min2'}), 'min2', '"min2"'); + +assert.sameValue(render({notation: 'compact'}), 'min2', 'compact, (omitted)'); +assert.sameValue(render({notation: 'compact', useGrouping: undefined}), 'min2', 'compact, undefined'); +assert.sameValue(render({notation: 'compact', useGrouping: 'auto'}), 'auto', 'compact, "auto"'); +assert.sameValue(render({notation: 'compact', useGrouping: true}), 'always', 'compact, true'); +assert.sameValue(render({notation: 'compact', useGrouping: 'always'}), 'always', 'compact, "always"'); +assert.sameValue(render({notation: 'compact', useGrouping: false}), false, 'compact, false'); +assert.sameValue(render({notation: 'compact', useGrouping: null}), false, 'compact, null'); +assert.sameValue(render({notation: 'compact', useGrouping: 'min2'}), 'min2', 'compact, "min2"'); + +assert.sameValue(render({useGrouping: 'false'}), 'auto', 'use fallback value'); +assert.sameValue(render({useGrouping: 'true'}), 'auto', 'use fallback value'); + +reportCompare(0, 0); |