diff options
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js')
-rw-r--r-- | js/src/tests/test262/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js b/js/src/tests/test262/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js new file mode 100644 index 0000000000..f28ba6c263 --- /dev/null +++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js @@ -0,0 +1,62 @@ +// Copyright 2019 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.numberformat.prototype.format +description: Checks handling of the signDisplay option to the NumberFormat constructor. +locale: [ja-JP] +features: [Intl.NumberFormat-unified] +---*/ + + +const tests = [ + [ + "auto", + "($987.00)", + "($0.00)", + "($0.00)", + "$0.00", + "$0.00", + "$987.00", + ], + [ + "always", + "($987.00)", + "($0.00)", + "($0.00)", + "+$0.00", + "+$0.00", + "+$987.00", + ], + [ + "never", + "$987.00", + "$0.00", + "$0.00", + "$0.00", + "$0.00", + "$987.00", + ], + [ + "exceptZero", + "($987.00)", + "$0.00", + "$0.00", + "$0.00", + "$0.00", + "+$987.00", + ], +]; + +for (const [signDisplay, negative, negativeNearZero, negativeZero, zero, positiveNearZero, positive] of tests) { + const nf = new Intl.NumberFormat("ja-JP", { style: "currency", currency: "USD", currencySign: "accounting", signDisplay }); + assert.sameValue(nf.format(-987), negative); + assert.sameValue(nf.format(-0.0001), negativeNearZero); + assert.sameValue(nf.format(-0), negativeZero); + assert.sameValue(nf.format(0), zero); + assert.sameValue(nf.format(0.0001), positiveNearZero); + assert.sameValue(nf.format(987), positive); +} + + +reportCompare(0, 0); |