v8/test/intl/number-format/format-currency.js
Jungshik Shin d9f4c84fa4 Roll ICU to ICU 62.1
See
  https://chromium-review.googlesource.com/c/chromium/deps/icu/+/1128503
for ICU changes.

Fix tests for ICU 61/Unicode 11/CLDR 33.1

* Update mjsunit/harmony/regexp-property-script-extensions.js per
  ScriptExtensions.txt in Unicode 11
* Update mjsunit/intl-numberformat-formattoparts.js for CLDR 33.1
* Mark an invalid Mozilla test (Georgian uppercasing)
* Fix currency format test (U+00A0 instead of U+0020)
* Enable Script_Extensions tests (test262)
* Add support for Extended_Pictographic in regex

Ref. https://github.com/tc39/ecma262/issues/1219.

Bug: chromium:850334, v8:7825
Test: intl/*, test262/intl402/*
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I146080cdc1164db4a71f484918723cf302666df8
Reviewed-on: https://chromium-review.googlesource.com/1111857
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54376}
2018-07-11 10:24:26 +00:00

20 lines
770 B
JavaScript
Executable File

// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Make sure currency formatting is correct (for USD only displays two decimal
// places, for JPY 0, and for EUR 2).
var nf_USD = new Intl.NumberFormat(['en'], {style: 'currency', currency: 'USD'});
assertEquals("$54,306.40", nf_USD.format(parseFloat(54306.4047970)));
var nf_JPY = new Intl.NumberFormat(['ja'],
{style: 'currency', currency: 'JPY', currencyDisplay: "code"});
assertEquals("JPY\u00a054,306", nf_JPY.format(parseFloat(54306.4047970)));
var nf_EUR = new Intl.NumberFormat(['pt'], {style: 'currency', currency: 'EUR'});
assertEquals("€\u00a01.000,00", nf_EUR.format(1000.00));