From e31f0a7d25668d3c1531294d2ef44a9f3bde4ef4 Mon Sep 17 00:00:00 2001 From: Michaël Zasso Date: Fri, 16 Aug 2019 11:32:46 +0200 Subject: deps: update V8 to 7.7.299.4 PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Jiawen Geng Reviewed-By: Rich Trott --- deps/v8/test/intl/general/supported-locales-of.js | 6 +- deps/v8/test/intl/intl.status | 3 + .../test/intl/number-format/property-override.js | 2 + .../number-format/unified/constructor-order.js | 16 +- .../intl/number-format/unified/currency-display.js | 2 +- .../unified/notation-engineering-formatToParts.js | 175 ++++++++++++++++++++ .../unified/notation-scientific-formatToParts.js | 177 +++++++++++++++++++++ .../v8/test/intl/number-format/unified/notation.js | 58 +++---- deps/v8/test/intl/number-format/unified/percent.js | 65 ++++++++ .../intl/number-format/unified/sign-display.js | 2 +- .../test/intl/number-format/unified/style-unit.js | 2 +- .../intl/number-format/unified/unit-display.js | 2 +- deps/v8/test/intl/regress-8866.js | 11 ++ deps/v8/test/intl/regress-9312.js | 32 ++++ deps/v8/test/intl/regress-9408.js | 28 ++++ deps/v8/test/intl/regress-9513.js | 28 ++++ .../v8/test/intl/relative-time-format/format-en.js | 24 +-- deps/v8/test/intl/testcfg.py | 3 + 18 files changed, 581 insertions(+), 55 deletions(-) create mode 100644 deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js create mode 100644 deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js create mode 100644 deps/v8/test/intl/number-format/unified/percent.js create mode 100644 deps/v8/test/intl/regress-8866.js create mode 100644 deps/v8/test/intl/regress-9312.js create mode 100644 deps/v8/test/intl/regress-9408.js create mode 100644 deps/v8/test/intl/regress-9513.js (limited to 'deps/v8/test/intl') diff --git a/deps/v8/test/intl/general/supported-locales-of.js b/deps/v8/test/intl/general/supported-locales-of.js index 5cc0095614..eb5c426f07 100644 --- a/deps/v8/test/intl/general/supported-locales-of.js +++ b/deps/v8/test/intl/general/supported-locales-of.js @@ -86,8 +86,10 @@ for (const service of services) { privateuseLocale2 = service.supportedLocalesOf("x-twain"); assertEquals(undefined, privateuseLocale2[0]); - grandfatheredLocale = service.supportedLocalesOf("art-lojban"); - assertEquals(undefined, grandfatheredLocale[0]); + if (service != Intl.PluralRules) { + grandfatheredLocale = service.supportedLocalesOf("art-lojban"); + assertEquals(undefined, grandfatheredLocale[0]); + } grandfatheredLocale2 = service.supportedLocalesOf("i-pwn"); assertEquals(undefined, grandfatheredLocale2[0]); diff --git a/deps/v8/test/intl/intl.status b/deps/v8/test/intl/intl.status index 81950f13b9..ba54743d67 100644 --- a/deps/v8/test/intl/intl.status +++ b/deps/v8/test/intl/intl.status @@ -34,6 +34,9 @@ 'collator/check-kf-option': [FAIL], 'collator/check-kn-option': [FAIL], + # https://code.google.com/p/v8/issues/detail?id=9312 + 'regress-9312': [FAIL], + # Slow tests. 'regress-903566': [PASS, SLOW], }], # ALWAYS diff --git a/deps/v8/test/intl/number-format/property-override.js b/deps/v8/test/intl/number-format/property-override.js index 1fbe78e080..590b1c2e4b 100644 --- a/deps/v8/test/intl/number-format/property-override.js +++ b/deps/v8/test/intl/number-format/property-override.js @@ -40,6 +40,8 @@ // Update both number-format.js and number-format.cc so they have the same // list of properties. +// Flags: --noharmony-intl-numberformat-unified + // First get supported properties. var properties = []; // Some properties are optional and won't show up in resolvedOptions if diff --git a/deps/v8/test/intl/number-format/unified/constructor-order.js b/deps/v8/test/intl/number-format/unified/constructor-order.js index 266426c7d4..be716371f5 100644 --- a/deps/v8/test/intl/number-format/unified/constructor-order.js +++ b/deps/v8/test/intl/number-format/unified/constructor-order.js @@ -34,26 +34,26 @@ new Intl.NumberFormat(['en-US'], { get unitDisplay() { assertEquals(6, getCount++); }, - // End of new options - get minimumIntegerDigits() { + get notation() { assertEquals(7, getCount++); }, - get minimumFractionDigits() { + // End of new options + get minimumIntegerDigits() { assertEquals(8, getCount++); }, - get maximumFractionDigits() { + get minimumFractionDigits() { assertEquals(9, getCount++); }, - get minimumSignificantDigits() { + get maximumFractionDigits() { assertEquals(10, getCount++); }, - get maximumSignificantDigits() { + get minimumSignificantDigits() { assertEquals(11, getCount++); }, - // Begin of new options - get notation() { + get maximumSignificantDigits() { assertEquals(12, getCount++); }, + // Begin of new options get compactDisplay() { assertEquals(13, getCount++); }, diff --git a/deps/v8/test/intl/number-format/unified/currency-display.js b/deps/v8/test/intl/number-format/unified/currency-display.js index 4f7acb97c8..effd026778 100644 --- a/deps/v8/test/intl/number-format/unified/currency-display.js +++ b/deps/v8/test/intl/number-format/unified/currency-display.js @@ -27,7 +27,7 @@ const testData = [ ["name", "123.00 New Taiwan dollars"], ["code", "TWD 123.00"], ["symbol", "NT$123.00"], - ["narrow-symbol", "$123.00"], // new + ["narrowSymbol", "$123.00"], // new ]; for (const [currencyDisplay, expectation] of testData) { diff --git a/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js b/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js new file mode 100644 index 0000000000..280771b2e7 --- /dev/null +++ b/deps/v8/test/intl/number-format/unified/notation-engineering-formatToParts.js @@ -0,0 +1,175 @@ +// Copyright 2019 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. + +// Flags: --harmony-intl-numberformat-unified + +// Test notation: "engineering" with formatToParts. + +const nf = Intl.NumberFormat("en", {notation: "engineering"}); + +let parts = nf.formatToParts(123.456); +// [{type: "integer", value: "123"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "456"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("integer", parts[0].type); +assertEquals("123", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("456", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentInteger", parts[4].type); +assertEquals("0", parts[4].value); +assertEquals(5, parts.length); + +parts = nf.formatToParts(-123.456); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "123"}, +// {type: "decimal", value: "."}, {type: "fraction", value: "456"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "0"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("123", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("456", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("0", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(12345678901234567890); +// [{type: "integer", value: "12"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "346"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "18"}] +assertEquals("integer", parts[0].type); +assertEquals("12", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("346", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentInteger", parts[4].type); +assertEquals("18", parts[4].value); +assertEquals(5, parts.length); + +parts = nf.formatToParts(-12345678901234567890); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "12"}, +// {type: "decimal", value: "."}, {type: "fraction", value: "346"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "18"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("12", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("346", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("18", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(0.000000000000123456); +// [{type: "integer", value: "123"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "456"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentMinusSign", value: "-"}, {type: "exponentInteger", value: "15"}] +assertEquals("integer", parts[0].type); +assertEquals("123", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("456", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentMinusSign", parts[4].type); +assertEquals("-", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("15", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(-0.000000000000123456); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "123"}, +// {type: "decimal", value: "."}, {type: "fraction", value: "456"}, +// {type: "exponentSeparator", value: "E"}, +// {type: "exponentMinusSign", value: "-"}, {type: "exponentInteger", value: "15"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("123", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("456", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentMinusSign", parts[5].type); +assertEquals("-", parts[5].value); +assertEquals("exponentInteger", parts[6].type); +assertEquals("15", parts[6].value); +assertEquals(7, parts.length); + +parts = nf.formatToParts(0); +// [{type: "integer", value: "0"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("integer", parts[0].type); +assertEquals("0", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); + +parts = nf.formatToParts(-0); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "0"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "0"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("0", parts[1].value); +assertEquals("exponentSeparator", parts[2].type); +assertEquals("E", parts[2].value); +assertEquals("exponentInteger", parts[3].type); +assertEquals("0", parts[3].value); +assertEquals(4, parts.length); + +parts = nf.formatToParts(Infinity); +// [{type: "infinity", value: "∞"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("infinity", parts[0].type); +assertEquals("∞", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); + +parts = nf.formatToParts(-Infinity); +// [{type: "minusSign", value: "-"}, {type: "infinity", value: "∞"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "0"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("infinity", parts[1].type); +assertEquals("∞", parts[1].value); +assertEquals("exponentSeparator", parts[2].type); +assertEquals("E", parts[2].value); +assertEquals("exponentInteger", parts[3].type); +assertEquals("0", parts[3].value); +assertEquals(4, parts.length); + +parts = nf.formatToParts(NaN); +// [{type: "nan", value: "NaN"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("nan", parts[0].type); +assertEquals("NaN", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); diff --git a/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js b/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js new file mode 100644 index 0000000000..9ffd5f8709 --- /dev/null +++ b/deps/v8/test/intl/number-format/unified/notation-scientific-formatToParts.js @@ -0,0 +1,177 @@ +// Copyright 2019 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. + +// Flags: --harmony-intl-numberformat-unified + +// Test notation: "scientific" with formatToParts. + +const nf = Intl.NumberFormat("en", {notation: "scientific"}); + +let parts = nf.formatToParts(123.456); +// [{type: "integer", value: "1"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "235"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "2"}] +assertEquals("integer", parts[0].type); +assertEquals("1", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("235", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentInteger", parts[4].type); +assertEquals("2", parts[4].value); +assertEquals(5, parts.length); + +parts = nf.formatToParts(-123.456); +// [{type: "minusSign", value: "-"},i +// {type: "integer", value: "1"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "235"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "2"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("1", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("235", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("2", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(12345678901234567890); +// [{type: "integer", value: "1"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "235"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "19"}] +assertEquals("integer", parts[0].type); +assertEquals("1", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("235", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentInteger", parts[4].type); +assertEquals("19", parts[4].value); +assertEquals(5, parts.length); + +parts = nf.formatToParts(-12345678901234567890); +// [{type: "minusSign", value: "-"}, +// {type: "integer", value: "1"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "235"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "19"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("1", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("235", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("19", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(0.000000000000123456); +// [{type: "integer", value: "1"}, {type: "decimal", value: "."}, +// {type: "fraction", value: "235"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentMinusSign", value: "-"}, {type: "exponentInteger", value: "13"}] +assertEquals("integer", parts[0].type); +assertEquals("1", parts[0].value); +assertEquals("decimal", parts[1].type); +assertEquals(".", parts[1].value); +assertEquals("fraction", parts[2].type); +assertEquals("235", parts[2].value); +assertEquals("exponentSeparator", parts[3].type); +assertEquals("E", parts[3].value); +assertEquals("exponentMinusSign", parts[4].type); +assertEquals("-", parts[4].value); +assertEquals("exponentInteger", parts[5].type); +assertEquals("13", parts[5].value); +assertEquals(6, parts.length); + +parts = nf.formatToParts(-0.000000000000123456); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "1"}, +// {type: "decimal", value: "."}, {type: "fraction", value: "235"}, +// {type: "exponentSeparator", value: "E"}, +// {type: "exponentMinusSign", value: "-"}, {type: "exponentInteger", value: "13"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("1", parts[1].value); +assertEquals("decimal", parts[2].type); +assertEquals(".", parts[2].value); +assertEquals("fraction", parts[3].type); +assertEquals("235", parts[3].value); +assertEquals("exponentSeparator", parts[4].type); +assertEquals("E", parts[4].value); +assertEquals("exponentMinusSign", parts[5].type); +assertEquals("-", parts[5].value); +assertEquals("exponentInteger", parts[6].type); +assertEquals("13", parts[6].value); +assertEquals(7, parts.length); + +parts = nf.formatToParts(0); +// [{type: "integer", value: "0"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("integer", parts[0].type); +assertEquals("0", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); + +parts = nf.formatToParts(-0); +// [{type: "minusSign", value: "-"}, {type: "integer", value: "0"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "0"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("integer", parts[1].type); +assertEquals("0", parts[1].value); +assertEquals("exponentSeparator", parts[2].type); +assertEquals("E", parts[2].value); +assertEquals("exponentInteger", parts[3].type); +assertEquals("0", parts[3].value); +assertEquals(4, parts.length); + +parts = nf.formatToParts(Infinity); +// [{type: "infinity", value: "∞"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("infinity", parts[0].type); +assertEquals("∞", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); + +parts = nf.formatToParts(-Infinity); +// [{type: "minusSign", value: "-"}, {type: "infinity", value: "∞"}, +// {type: "exponentSeparator", value: "E"}, {type: "exponentInteger", value: "0"}] +assertEquals("minusSign", parts[0].type); +assertEquals("-", parts[0].value); +assertEquals("infinity", parts[1].type); +assertEquals("∞", parts[1].value); +assertEquals("exponentSeparator", parts[2].type); +assertEquals("E", parts[2].value); +assertEquals("exponentInteger", parts[3].type); +assertEquals("0", parts[3].value); +assertEquals(4, parts.length); + +parts = nf.formatToParts(NaN); +// [{type: "nan", value: "NaN"}, {type: "exponentSeparator", value: "E"}, +// {type: "exponentInteger", value: "0"}] +assertEquals("nan", parts[0].type); +assertEquals("NaN", parts[0].value); +assertEquals("exponentSeparator", parts[1].type); +assertEquals("E", parts[1].value); +assertEquals("exponentInteger", parts[2].type); +assertEquals("0", parts[2].value); +assertEquals(3, parts.length); diff --git a/deps/v8/test/intl/number-format/unified/notation.js b/deps/v8/test/intl/number-format/unified/notation.js index 9c451773bd..b26ee01f5c 100644 --- a/deps/v8/test/intl/number-format/unified/notation.js +++ b/deps/v8/test/intl/number-format/unified/notation.js @@ -19,9 +19,9 @@ const testData = [ ["standard", undefined, "987,654,321"], ["scientific", undefined, "9.877E8"], ["engineering", undefined, "987.654E6"], - ["compact", undefined, "987.654M"], - ["compact", "short", "987.654M"], - ["compact", "long", "987.654 million"], + ["compact", undefined, "988M"], + ["compact", "short", "988M"], + ["compact", "long", "988 million"], ]; for (const [notation, compactDisplay, expect1] of testData) { @@ -40,50 +40,50 @@ for (const [notation, compactDisplay, expect1] of testData) { // Test Germany which has different decimal marks. let notation = "compact"; nf = new Intl.NumberFormat("de", {notation, compactDisplay: "short"}); -assertEquals("987,654 Mio.", nf.format(987654321)); -assertEquals("98,765 Mio.", nf.format(98765432)); +assertEquals("988 Mio.", nf.format(987654321)); +assertEquals("99 Mio.", nf.format(98765432)); assertEquals("98.765", nf.format(98765)); assertEquals("9876", nf.format(9876)); nf = new Intl.NumberFormat("de", {notation, compactDisplay: "long"}); -assertEquals("987,654 Millionen", nf.format(987654321)); -assertEquals("98,765 Millionen", nf.format(98765432)); -assertEquals("98,765 Tausend", nf.format(98765)); -assertEquals("9,876 Tausend", nf.format(9876)); +assertEquals("988 Millionen", nf.format(987654321)); +assertEquals("99 Millionen", nf.format(98765432)); +assertEquals("99 Tausend", nf.format(98765)); +assertEquals("9,9 Tausend", nf.format(9876)); // Test Chinese, Japanese and Korean, which group by 4 digits. nf = new Intl.NumberFormat("zh-TW", {notation, compactDisplay: "short"}); -assertEquals("9.877億", nf.format(987654321)); -assertEquals("9876.543萬", nf.format(98765432)); -assertEquals("9.877萬", nf.format(98765)); +assertEquals("9.9億", nf.format(987654321)); +assertEquals("9877萬", nf.format(98765432)); +assertEquals("9.9萬", nf.format(98765)); assertEquals("9876", nf.format(9876)); nf = new Intl.NumberFormat("zh-TW", {notation, compactDisplay: "long"}); -assertEquals("9.877億", nf.format(987654321)); -assertEquals("9876.543萬", nf.format(98765432)); -assertEquals("9.877萬", nf.format(98765)); +assertEquals("9.9億", nf.format(987654321)); +assertEquals("9877萬", nf.format(98765432)); +assertEquals("9.9萬", nf.format(98765)); assertEquals("9876", nf.format(9876)); // Test Japanese with compact. nf = new Intl.NumberFormat("ja", {notation, compactDisplay: "short"}); -assertEquals("9.877億", nf.format(987654321)); -assertEquals("9876.543万", nf.format(98765432)); -assertEquals("9.877万", nf.format(98765)); +assertEquals("9.9億", nf.format(987654321)); +assertEquals("9877万", nf.format(98765432)); +assertEquals("9.9万", nf.format(98765)); assertEquals("9876", nf.format(9876)); nf = new Intl.NumberFormat("ja", {notation, compactDisplay: "long"}); -assertEquals("9.877億", nf.format(987654321)); -assertEquals("9876.543万", nf.format(98765432)); -assertEquals("9.877万", nf.format(98765)); +assertEquals("9.9億", nf.format(987654321)); +assertEquals("9877万", nf.format(98765432)); +assertEquals("9.9万", nf.format(98765)); assertEquals("9876", nf.format(9876)); // Test Korean with compact. nf = new Intl.NumberFormat("ko", {notation, compactDisplay: "short"}); -assertEquals("9.877억", nf.format(987654321)); -assertEquals("9876.543만", nf.format(98765432)); -assertEquals("9.877만", nf.format(98765)); -assertEquals("9.876천", nf.format(9876)); +assertEquals("9.9억", nf.format(987654321)); +assertEquals("9877만", nf.format(98765432)); +assertEquals("9.9만", nf.format(98765)); +assertEquals("9.9천", nf.format(9876)); assertEquals("987", nf.format(987)); nf = new Intl.NumberFormat("ko", {notation, compactDisplay: "long"}); -assertEquals("9.877억", nf.format(987654321)); -assertEquals("9876.543만", nf.format(98765432)); -assertEquals("9.877만", nf.format(98765)); -assertEquals("9.876천", nf.format(9876)); +assertEquals("9.9억", nf.format(987654321)); +assertEquals("9877만", nf.format(98765432)); +assertEquals("9.9만", nf.format(98765)); +assertEquals("9.9천", nf.format(9876)); assertEquals("987", nf.format(987)); diff --git a/deps/v8/test/intl/number-format/unified/percent.js b/deps/v8/test/intl/number-format/unified/percent.js new file mode 100644 index 0000000000..9918210ec7 --- /dev/null +++ b/deps/v8/test/intl/number-format/unified/percent.js @@ -0,0 +1,65 @@ +// Copyright 2019 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. + +// Flags: --harmony-intl-numberformat-unified +// +// Test the handling of "percent" w/ "unit" + +let nf1 = new Intl.NumberFormat("en-US", { + style: "percent", + unitDisplay: "long" // Read, but ignored. +}); + +let resolved1 = nf1.resolvedOptions(); +assertEquals("percent", resolved1.style); +assertEquals(undefined, resolved1.unit); +assertEquals(undefined, resolved1.unitDisplay); + +let parts1 = nf1.formatToParts(100); +assertEquals(4, parts1.length); +assertEquals("integer", parts1[0].type); +assertEquals("10", parts1[0].value); +assertEquals("group", parts1[1].type); +assertEquals(",", parts1[1].value); +assertEquals("integer", parts1[2].type); +assertEquals("000", parts1[2].value); +assertEquals("percentSign", parts1[3].type); +assertEquals("%", parts1[3].value); + +let nf2 = new Intl.NumberFormat("en-US", { + style: "unit", + unit: "percent", + unitDisplay: "long" // This is OK +}); + +let resolved2 = nf2.resolvedOptions(); +assertEquals("unit", resolved2.style); +assertEquals("percent", resolved2.unit); +assertEquals("long", resolved2.unitDisplay); + +let parts2 = nf2.formatToParts(100); +assertEquals(3, parts2.length); +assertEquals("integer", parts2[0].type); +assertEquals("100", parts2[0].value); +assertEquals("literal", parts2[1].type); +assertEquals(" ", parts2[1].value); +assertEquals("unit", parts2[2].type); +assertEquals("percent", parts2[2].value); + +let nf3 = new Intl.NumberFormat("en-US", { + style: "unit", + unit: "percent" +}); + +let resolved3 = nf3.resolvedOptions(); +assertEquals("unit", resolved3.style); +assertEquals("percent", resolved3.unit); +assertEquals("short", resolved3.unitDisplay); + +let parts3 = nf3.formatToParts(100); +assertEquals(2, parts3.length); +assertEquals("integer", parts3[0].type); +assertEquals("100", parts3[0].value); +assertEquals("unit", parts3[1].type); +assertEquals("%", parts3[1].value); diff --git a/deps/v8/test/intl/number-format/unified/sign-display.js b/deps/v8/test/intl/number-format/unified/sign-display.js index cdd7de0061..c71f57e67c 100644 --- a/deps/v8/test/intl/number-format/unified/sign-display.js +++ b/deps/v8/test/intl/number-format/unified/sign-display.js @@ -15,7 +15,7 @@ const testData = [ ["auto", "-123", "-0", "0", "123"], ["always", "-123", "-0", "+0", "+123"], ["never", "123", "0", "0", "123"], - ["except-zero", "-123", "-0", "0", "+123"], + ["exceptZero", "-123", "-0", "0", "+123"], ]; for (const [signDisplay, neg, negZero, zero, pos] of testData) { diff --git a/deps/v8/test/intl/number-format/unified/style-unit.js b/deps/v8/test/intl/number-format/unified/style-unit.js index af35618fda..b88af0fb76 100644 --- a/deps/v8/test/intl/number-format/unified/style-unit.js +++ b/deps/v8/test/intl/number-format/unified/style-unit.js @@ -19,7 +19,7 @@ nf = new Intl.NumberFormat("en", {style: 'currency', currency: 'TWD'}); assertEquals(undefined, nf.resolvedOptions().unit); nf = new Intl.NumberFormat("en", {style: 'percent'}); -assertEquals('percent', nf.resolvedOptions().unit); +assertEquals(undefined, nf.resolvedOptions().unit); assertThrows(() => new Intl.NumberFormat("en", {style: 'unit'}), TypeError); diff --git a/deps/v8/test/intl/number-format/unified/unit-display.js b/deps/v8/test/intl/number-format/unified/unit-display.js index eeb2c69ece..d4d814d70e 100644 --- a/deps/v8/test/intl/number-format/unified/unit-display.js +++ b/deps/v8/test/intl/number-format/unified/unit-display.js @@ -21,7 +21,7 @@ nf = new Intl.NumberFormat("en", {style: 'unit', unit: "meter"}); assertEquals("short", nf.resolvedOptions().unitDisplay); nf = new Intl.NumberFormat("en", {style: 'percent'}); -assertEquals("short", nf.resolvedOptions().unitDisplay); +assertEquals(undefined, nf.resolvedOptions().unitDisplay); const testData = [ ["short"], diff --git a/deps/v8/test/intl/regress-8866.js b/deps/v8/test/intl/regress-8866.js new file mode 100644 index 0000000000..ed5b4a0ce4 --- /dev/null +++ b/deps/v8/test/intl/regress-8866.js @@ -0,0 +1,11 @@ +// Copyright 2019 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. + +// Regression test to ensure Intl.PluralRules respect minimumFractionDigits + +assertEquals('other', + new Intl.PluralRules("en", {minimumFractionDigits: 2}).select(1)); + +assertEquals('zero', + new Intl.PluralRules("lv", {minimumFractionDigits: 2}).select(1.13)); diff --git a/deps/v8/test/intl/regress-9312.js b/deps/v8/test/intl/regress-9312.js new file mode 100644 index 0000000000..7bcd241001 --- /dev/null +++ b/deps/v8/test/intl/regress-9312.js @@ -0,0 +1,32 @@ +// Copyright 2019 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. + +// Test the locales in src/third_party/icu/source/data/locales/ which +// has %%ALIAS output the same as what it alias to instead of root. +const aliases = new Map([ + ['sh', 'sr-Latn'], + ['in', 'id'], + ['mo', 'ro'], + ['iw', 'he'], + ['no', 'nb'], + ['tl', 'fil'], + ['iw-IL', 'he-IL'], + ['sr-CS', 'sr-Cyrl-RS'], +]); + +const date = new Date(); +const number = 123456789.123456789; +for (const [from, to] of aliases) { + const fromDTF = new Intl.DateTimeFormat(from, {month: 'long', weekday: 'long'}); + const toDTF = new Intl.DateTimeFormat(to, {month: 'long', weekday: 'long'}); + for (let m = 0; m < 12; m++) { + date.setMonth(m); + assertEquals(fromDTF.format(date), toDTF.format(date), + `Expected to see the same output from "${from}" and "${to}".`); + } + const fromNF = new Intl.NumberFormat(from); + const toNF = new Intl.NumberFormat(to); + assertEquals(fromNF.format(number), toNF.format(number), + `Expected to see the same output from "${from}" and "${to}".`); +} diff --git a/deps/v8/test/intl/regress-9408.js b/deps/v8/test/intl/regress-9408.js new file mode 100644 index 0000000000..88883981f3 --- /dev/null +++ b/deps/v8/test/intl/regress-9408.js @@ -0,0 +1,28 @@ +// Copyright 2019 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. + +// Flags: --harmony-intl-numberformat-unified +// Test precision of compact-rounding + +let compact = {notation: "compact"}; +assertEquals("1.2K", (1234).toLocaleString("en", compact)); +assertEquals("12K", (12345).toLocaleString("en", compact)); +assertEquals("123K", (123456).toLocaleString("en", compact)); +assertEquals("1.2M", (1234567).toLocaleString("en", compact)); + +assertEquals("54K", (54321).toLocaleString("en", compact)); + +let compact_no_rounding = {notation: "compact", minimumFractionDigits: 0}; +assertEquals("1.234K", (1234).toLocaleString("en", compact_no_rounding)); +assertEquals("12.345K", (12345).toLocaleString("en", compact_no_rounding)); +assertEquals("123.456K", (123456).toLocaleString("en", compact_no_rounding)); +assertEquals("1.235M", (1234567).toLocaleString("en", compact_no_rounding)); + +assertEquals("54.321K", (54321).toLocaleString("en", compact_no_rounding)); + +let fmt = new Intl.NumberFormat("en", compact_no_rounding); +assertEquals("1", fmt.format(1)); +assertEquals("1K", fmt.format(1000)); +assertEquals("1.234K", fmt.format(1234)); +assertEquals("1.25K", fmt.format(1250)); diff --git a/deps/v8/test/intl/regress-9513.js b/deps/v8/test/intl/regress-9513.js new file mode 100644 index 0000000000..e23b5cf77e --- /dev/null +++ b/deps/v8/test/intl/regress-9513.js @@ -0,0 +1,28 @@ +// Copyright 2019 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. + +// Flags: --harmony-intl-numberformat-unified +// Test Infinity, -Infinity, NaN won't crash with any notation in formatToParts. + +let validNotations = [ + "standard", + "compact", + "engineering", + "scientific", +]; + +let tests = [ + 123, + Infinity, + -Infinity, + NaN +]; + +for (const notation of validNotations) { + let nf = new Intl.NumberFormat("en", {notation}); + for (const test of tests) { + assertDoesNotThrow(() => nf.format(test)); + assertDoesNotThrow(() => nf.formatToParts(test)); + } +} diff --git a/deps/v8/test/intl/relative-time-format/format-en.js b/deps/v8/test/intl/relative-time-format/format-en.js index a365749f0a..d802902587 100644 --- a/deps/v8/test/intl/relative-time-format/format-en.js +++ b/deps/v8/test/intl/relative-time-format/format-en.js @@ -23,8 +23,8 @@ assertEquals('in 345 seconds', longAuto.format(345, 'second')); assertEquals('3 minutes ago', longAuto.format(-3, 'minute')); assertEquals('2 minutes ago', longAuto.format(-2, 'minute')); assertEquals('1 minute ago', longAuto.format(-1, 'minute')); -assertEquals('in 0 minutes', longAuto.format(0, 'minute')); -assertEquals('0 minutes ago', longAuto.format(-0, 'minute')); +assertEquals('this minute', longAuto.format(0, 'minute')); +assertEquals('this minute', longAuto.format(-0, 'minute')); assertEquals('in 1 minute', longAuto.format(1, 'minute')); assertEquals('in 2 minutes', longAuto.format(2, 'minute')); assertEquals('in 345 minutes', longAuto.format(345, 'minute')); @@ -32,8 +32,8 @@ assertEquals('in 345 minutes', longAuto.format(345, 'minute')); assertEquals('3 hours ago', longAuto.format(-3, 'hour')); assertEquals('2 hours ago', longAuto.format(-2, 'hour')); assertEquals('1 hour ago', longAuto.format(-1, 'hour')); -assertEquals('in 0 hours', longAuto.format(0, 'hour')); -assertEquals('0 hours ago', longAuto.format(-0, 'hour')); +assertEquals('this hour', longAuto.format(0, 'hour')); +assertEquals('this hour', longAuto.format(-0, 'hour')); assertEquals('in 1 hour', longAuto.format(1, 'hour')); assertEquals('in 2 hours', longAuto.format(2, 'hour')); assertEquals('in 345 hours', longAuto.format(345, 'hour')); @@ -98,8 +98,8 @@ assertEquals('in 345 sec.', shortAuto.format(345, 'second')); assertEquals('3 min. ago', shortAuto.format(-3, 'minute')); assertEquals('2 min. ago', shortAuto.format(-2, 'minute')); assertEquals('1 min. ago', shortAuto.format(-1, 'minute')); -assertEquals('in 0 min.', shortAuto.format(0, 'minute')); -assertEquals('0 min. ago', shortAuto.format(-0, 'minute')); +assertEquals('this minute', shortAuto.format(0, 'minute')); +assertEquals('this minute', shortAuto.format(-0, 'minute')); assertEquals('in 1 min.', shortAuto.format(1, 'minute')); assertEquals('in 2 min.', shortAuto.format(2, 'minute')); assertEquals('in 345 min.', shortAuto.format(345, 'minute')); @@ -107,8 +107,8 @@ assertEquals('in 345 min.', shortAuto.format(345, 'minute')); assertEquals('3 hr. ago', shortAuto.format(-3, 'hour')); assertEquals('2 hr. ago', shortAuto.format(-2, 'hour')); assertEquals('1 hr. ago', shortAuto.format(-1, 'hour')); -assertEquals('in 0 hr.', shortAuto.format(0, 'hour')); -assertEquals('0 hr. ago', shortAuto.format(-0, 'hour')); +assertEquals('this hour', shortAuto.format(0, 'hour')); +assertEquals('this hour', shortAuto.format(-0, 'hour')); assertEquals('in 1 hr.', shortAuto.format(1, 'hour')); assertEquals('in 2 hr.', shortAuto.format(2, 'hour')); assertEquals('in 345 hr.', shortAuto.format(345, 'hour')); @@ -174,8 +174,8 @@ assertEquals('in 345 sec.', narrowAuto.format(345, 'second')); assertEquals('3 min. ago', narrowAuto.format(-3, 'minute')); assertEquals('2 min. ago', narrowAuto.format(-2, 'minute')); assertEquals('1 min. ago', narrowAuto.format(-1, 'minute')); -assertEquals('in 0 min.', narrowAuto.format(0, 'minute')); -assertEquals('0 min. ago', narrowAuto.format(-0, 'minute')); +assertEquals('this minute', narrowAuto.format(0, 'minute')); +assertEquals('this minute', narrowAuto.format(-0, 'minute')); assertEquals('in 1 min.', narrowAuto.format(1, 'minute')); assertEquals('in 2 min.', narrowAuto.format(2, 'minute')); assertEquals('in 345 min.', narrowAuto.format(345, 'minute')); @@ -183,8 +183,8 @@ assertEquals('in 345 min.', narrowAuto.format(345, 'minute')); assertEquals('3 hr. ago', narrowAuto.format(-3, 'hour')); assertEquals('2 hr. ago', narrowAuto.format(-2, 'hour')); assertEquals('1 hr. ago', narrowAuto.format(-1, 'hour')); -assertEquals('in 0 hr.', narrowAuto.format(0, 'hour')); -assertEquals('0 hr. ago', narrowAuto.format(-0, 'hour')); +assertEquals('this hour', narrowAuto.format(0, 'hour')); +assertEquals('this hour', narrowAuto.format(-0, 'hour')); assertEquals('in 1 hr.', narrowAuto.format(1, 'hour')); assertEquals('in 2 hr.', narrowAuto.format(2, 'hour')); assertEquals('in 345 hr.', narrowAuto.format(345, 'hour')); diff --git a/deps/v8/test/intl/testcfg.py b/deps/v8/test/intl/testcfg.py index 66da4c77b5..f04bf19c8c 100644 --- a/deps/v8/test/intl/testcfg.py +++ b/deps/v8/test/intl/testcfg.py @@ -58,6 +58,9 @@ class TestCase(testcase.D8TestCase): def _parse_source_env(self, source): env_match = ENV_PATTERN.search(source) + # https://crbug.com/v8/8845 + if 'LC_ALL' in os.environ: + del os.environ['LC_ALL'] env = {} if env_match: for env_pair in env_match.group(1).strip().split(): -- cgit v1.2.3