summaryrefslogtreecommitdiff
path: root/deps/v8/test/intl
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/intl')
-rw-r--r--deps/v8/test/intl/collator/default-locale.js8
-rw-r--r--deps/v8/test/intl/collator/property-override.js2
-rw-r--r--deps/v8/test/intl/date-format/timezone.js35
-rw-r--r--deps/v8/test/intl/general/getCanonicalLocales.js26
-rw-r--r--deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js27
-rw-r--r--deps/v8/test/intl/general/language_tags_with_preferred_values.js11
-rw-r--r--deps/v8/test/intl/list-format/constructor.js108
-rw-r--r--deps/v8/test/intl/list-format/format-en.js119
-rw-r--r--deps/v8/test/intl/list-format/format-to-parts.js92
-rw-r--r--deps/v8/test/intl/list-format/format.js63
-rw-r--r--deps/v8/test/intl/list-format/formatToParts-zh.js157
-rw-r--r--deps/v8/test/intl/list-format/resolved-options.js155
-rw-r--r--deps/v8/test/intl/locale/locale-constructor.js5
-rw-r--r--deps/v8/test/intl/locale/maximize_minimize.js138
-rw-r--r--deps/v8/test/intl/locale/regress-8032.js7
-rw-r--r--deps/v8/test/intl/number-format/options.js13
-rw-r--r--deps/v8/test/intl/regress-8030.js21
-rw-r--r--deps/v8/test/intl/regress-8031.js22
-rw-r--r--deps/v8/test/intl/regress-8725514.js10
-rw-r--r--deps/v8/test/intl/regress-875643.js5
-rw-r--r--deps/v8/test/intl/relative-time-format/format-en.js502
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts-en.js68
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts.js82
-rw-r--r--deps/v8/test/intl/relative-time-format/format.js82
24 files changed, 1717 insertions, 41 deletions
diff --git a/deps/v8/test/intl/collator/default-locale.js b/deps/v8/test/intl/collator/default-locale.js
index 5fc6ff4665..fd964f0620 100644
--- a/deps/v8/test/intl/collator/default-locale.js
+++ b/deps/v8/test/intl/collator/default-locale.js
@@ -48,8 +48,6 @@ var collatorBraket = new Intl.Collator({});
assertEquals(options.locale, collatorBraket.resolvedOptions().locale);
var collatorWithOptions = new Intl.Collator(undefined, {usage: 'search'});
-assertLanguageTag(%GetDefaultICULocale(),
- collatorWithOptions.resolvedOptions().locale);
-assertNotNull(
- %regexp_internal_match(/-u(-[a-zA-Z]+-[a-zA-Z]+)*-co-search/,
- collatorWithOptions.resolvedOptions().locale));
+var locale = collatorWithOptions.resolvedOptions().locale;
+assertLanguageTag(%GetDefaultICULocale(), locale);
+assertEquals(locale.indexOf('-co-search'), -1);
diff --git a/deps/v8/test/intl/collator/property-override.js b/deps/v8/test/intl/collator/property-override.js
index bed4d7773d..1e17b1e741 100644
--- a/deps/v8/test/intl/collator/property-override.js
+++ b/deps/v8/test/intl/collator/property-override.js
@@ -61,5 +61,3 @@ properties.forEach(function(prop) {
});
taintProperties(properties);
-
-var locale = Intl.Collator().resolvedOptions().locale;
diff --git a/deps/v8/test/intl/date-format/timezone.js b/deps/v8/test/intl/date-format/timezone.js
index af363711c7..57044d48d8 100644
--- a/deps/v8/test/intl/date-format/timezone.js
+++ b/deps/v8/test/intl/date-format/timezone.js
@@ -31,11 +31,15 @@
// var df = Intl.DateTimeFormat();
// assertEquals(getDefaultTimeZone(), df.resolvedOptions().timeZone);
-df = Intl.DateTimeFormat(undefined, {timeZone: 'UtC'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
+[
+ 'UtC', 'gmt', 'Etc/UTC', 'Etc/GMT', 'Etc/GMT0', 'Etc/GMT+0',
+ 'etc/gmt-0', 'etc/zulu', 'Etc/universal', 'etc/greenwich'
+].forEach((timezone) => {
+ const df = Intl.DateTimeFormat(undefined, {timeZone: timezone});
+ assertEquals('UTC', df.resolvedOptions().timeZone);
+})
-df = Intl.DateTimeFormat(undefined, {timeZone: 'gmt'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
+// See test/mjsunit/regress/regress-crbug-364374.js for additional/ tests.
df = Intl.DateTimeFormat(undefined, {timeZone: 'America/Los_Angeles'});
assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
@@ -43,22 +47,29 @@ assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
df = Intl.DateTimeFormat(undefined, {timeZone: 'Europe/Belgrade'});
assertEquals('Europe/Belgrade', df.resolvedOptions().timeZone);
-// Check Etc/XXX variants. They should work too.
-df = Intl.DateTimeFormat(undefined, {timeZone: 'Etc/UTC'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
-
-df = Intl.DateTimeFormat(undefined, {timeZone: 'Etc/GMT'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
-
df = Intl.DateTimeFormat(undefined, {timeZone: 'euRope/beLGRade'});
assertEquals('Europe/Belgrade', df.resolvedOptions().timeZone);
+// Etc/GMT-14 to Etc/GMT+12 are valid.
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt+12'});
+assertEquals('Etc/GMT+12', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt+9'});
+assertEquals('Etc/GMT+9', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt-9'});
+assertEquals('Etc/GMT-9', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt-14'});
+assertEquals('Etc/GMT-14', df.resolvedOptions().timeZone);
+
+assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'Etc/GMT+13\'})');
+
// : + - are not allowed, only / _ are.
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT+07:00\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT+0700\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT-05:00\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT-0500\'})');
-assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'Etc/GMT+0\'})');
assertThrows('Intl.DateTimeFormat(undefined, ' +
'{timeZone: \'America/Los-Angeles\'})');
diff --git a/deps/v8/test/intl/general/getCanonicalLocales.js b/deps/v8/test/intl/general/getCanonicalLocales.js
index dd01363c4f..0df6846ce6 100644
--- a/deps/v8/test/intl/general/getCanonicalLocales.js
+++ b/deps/v8/test/intl/general/getCanonicalLocales.js
@@ -2,24 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var locales = ['en-US', 'fr'];
-var result = Intl.getCanonicalLocales(locales);
-var len = result.length
+// Ignore the first tag when checking for duplicate subtags.
+assertDoesNotThrow(() => Intl.getCanonicalLocales("foobar-foobar"));
-// TODO(jshin): Remove the following when
-// https://github.com/tc39/test262/issues/745 is resolved and
-// test262 in v8 is updated.
+// Ignore duplicate subtags in different namespaces; eg, 'a' vs 'u'.
+assertDoesNotThrow(() => Intl.getCanonicalLocales("en-a-ca-Chinese-u-ca-Chinese"));
-assertEquals(Object.getPrototypeOf(result), Array.prototype);
-assertEquals(result.constructor, Array);
-
-for (var key in result) {
- var desc = Object.getOwnPropertyDescriptor(result, key);
- assertTrue(desc.writable);
- assertTrue(desc.configurable);
- assertTrue(desc.enumerable);
-}
-
-var desc = Object.getOwnPropertyDescriptor(result, 'length');
-assertTrue(desc.writable);
-assertEquals(result.push('de'), desc.value + 1);
+// Check duplicate subtags (after the first tag) are detected.
+assertThrows(() => Intl.getCanonicalLocales("en-foobar-foobar"), RangeError);
+assertThrows(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese"), RangeError);
diff --git a/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js
new file mode 100644
index 0000000000..b4d529652f
--- /dev/null
+++ b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js
@@ -0,0 +1,27 @@
+// Copyright 2018 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.
+
+[
+ // Grandfathered tags without a preferred value in the IANA language
+ // tag registry. Nonetheless, ICU cooks up a value when canonicalizing.
+ // v8 works around that ICU issue.
+ // See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
+ ["cel-gaulish", "cel-gaulish"],
+ ["i-default", "i-default"],
+ ["i-mingo", "i-mingo"],
+ ["i-enochian", "i-enochian"],
+ ["zh-min", "zh-min"],
+
+ // Matching should be case-insensitive.
+ ["I-default", "i-default"],
+ ["i-DEFAULT", "i-default"],
+ ["I-DEFAULT", "i-default"],
+ ["i-DEfauLT", "i-default"],
+ ["zh-Min", "zh-min"],
+ ["Zh-min", "zh-min"],
+].forEach(([inputLocale, expectedLocale]) => {
+ const canonicalLocales = Intl.getCanonicalLocales(inputLocale);
+ assertEquals(canonicalLocales.length, 1);
+ assertEquals(canonicalLocales[0], expectedLocale);
+})
diff --git a/deps/v8/test/intl/general/language_tags_with_preferred_values.js b/deps/v8/test/intl/general/language_tags_with_preferred_values.js
index 391db53a98..073a6c9aff 100644
--- a/deps/v8/test/intl/general/language_tags_with_preferred_values.js
+++ b/deps/v8/test/intl/general/language_tags_with_preferred_values.js
@@ -7,6 +7,11 @@
["sgn-de", "gsg"],
["sgn-de-u-co-phonebk", "gsg-u-co-phonebk"],
+ // Matching should be case-insensitive.
+ ["sgn-De", "gsg"],
+ ["sgn-BE-FR", "sfb"],
+ ["Sgn-bE-Fr", "sfb"],
+
// deprecated region tag
["und-Latn-dd", "und-Latn-DE"],
["und-dd-u-co-phonebk", "und-DE-u-co-phonebk"],
@@ -22,8 +27,8 @@
["jw", "jv"],
["aam", "aas"],
["aam-u-ca-gregory", "aas-u-ca-gregory"],
-].forEach(function (entry) {
- const canonicalLocales = Intl.getCanonicalLocales(entry[0]);
+].forEach(([inputLocale, expectedLocale]) => {
+ const canonicalLocales = Intl.getCanonicalLocales(inputLocale);
assertEquals(canonicalLocales.length, 1);
- assertEquals(canonicalLocales[0], entry[1]);
+ assertEquals(canonicalLocales[0], expectedLocale);
})
diff --git a/deps/v8/test/intl/list-format/constructor.js b/deps/v8/test/intl/list-format/constructor.js
new file mode 100644
index 0000000000..33a85fd79f
--- /dev/null
+++ b/deps/v8/test/intl/list-format/constructor.js
@@ -0,0 +1,108 @@
+// Copyright 2018 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-list-format
+
+// ListFormat constructor can't be called as function.
+assertThrows(() => Intl.ListFormat(['sr']), TypeError);
+
+// Non-string locale.
+// assertThrows(() => new Intl.ListFormat(5), TypeError);
+
+// Invalid locale string.
+assertThrows(() => new Intl.ListFormat(['abcdefghi']), RangeError);
+
+assertDoesNotThrow(() => new Intl.ListFormat(['sr'], {}), TypeError);
+
+assertDoesNotThrow(() => new Intl.ListFormat([], {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat(['fr', 'ar'], {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat({0: 'ja', 1:'fr'}, {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat({1: 'ja', 2:'fr'}, {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat(['sr']));
+
+assertDoesNotThrow(() => new Intl.ListFormat());
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(
+ ['sr'], {
+ style: 'short',
+ type: 'unit'
+ }));
+
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit'}));
+
+assertThrows(
+ () => new Intl.ListFormat(['sr'], {type: 'standard'}),
+ RangeError);
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'narrow'}));
+
+assertThrows(
+ () => new Intl.ListFormat(['sr'], {style: 'giant'}),
+ RangeError);
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'narrow'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'narrow'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'narrow'}));
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let style = -1;
+let type = -1;
+
+new Intl.ListFormat(['en-US'], {
+ get style() {
+ style = ++getCount;
+ },
+ get type() {
+ type = ++getCount;
+ }
+});
+
+assertEquals(1, type);
+assertEquals(2, style);
diff --git a/deps/v8/test/intl/list-format/format-en.js b/deps/v8/test/intl/list-format/format-en.js
new file mode 100644
index 0000000000..21eb99d06d
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format-en.js
@@ -0,0 +1,119 @@
+// Copyright 2018 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-list-format
+
+// The following test are not part of the comformance. Just some output in
+// English to verify the format does return something reasonable for English.
+// It may be changed when we update the CLDR data.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-list-time/
+
+let enLongConjunction = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'conjunction'});
+
+assertEquals('', enLongConjunction.format());
+ assertEquals('', enLongConjunction.format([]));
+assertEquals('a', enLongConjunction.format(['a']));
+assertEquals('b', enLongConjunction.format(['b']));
+assertEquals('a and b', enLongConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enLongConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enLongConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enLongConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enLongDisjunction = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'disjunction'});
+
+assertEquals('', enLongDisjunction.format());
+assertEquals('', enLongDisjunction.format([]));
+assertEquals('a', enLongDisjunction.format(['a']));
+assertEquals('b', enLongDisjunction.format(['b']));
+assertEquals('a or b', enLongDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enLongDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enLongDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enLongDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enLongUnit = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'unit'});
+
+assertEquals('', enLongUnit.format());
+assertEquals('', enLongUnit.format([]));
+assertEquals('a', enLongUnit.format(['a']));
+assertEquals('b', enLongUnit.format(['b']));
+assertEquals('a, b', enLongUnit.format(['a', 'b']));
+assertEquals('a, b, c', enLongUnit.format(['a', 'b', 'c']));
+assertEquals('a, b, c, d', enLongUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or', enLongUnit.format(['a', 'b', 'c', 'd', 'or']));
+
+let enShortConjunction = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'conjunction'});
+
+assertEquals('', enShortConjunction.format());
+assertEquals('', enShortConjunction.format([]));
+assertEquals('a', enShortConjunction.format(['a']));
+assertEquals('b', enShortConjunction.format(['b']));
+assertEquals('a and b', enShortConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enShortConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enShortConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enShortConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enShortDisjunction = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'disjunction'});
+
+assertEquals('', enShortDisjunction.format());
+assertEquals('', enShortDisjunction.format([]));
+assertEquals('a', enShortDisjunction.format(['a']));
+assertEquals('b', enShortDisjunction.format(['b']));
+assertEquals('a or b', enShortDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enShortDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enShortDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enShortDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enShortUnit = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'unit'});
+
+assertEquals('', enShortUnit.format());
+assertEquals('', enShortUnit.format([]));
+assertEquals('a', enShortUnit.format(['a']));
+assertEquals('b', enShortUnit.format(['b']));
+assertEquals('a, b', enShortUnit.format(['a', 'b']));
+assertEquals('a, b, c', enShortUnit.format(['a', 'b', 'c']));
+assertEquals('a, b, c, d', enShortUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or', enShortUnit.format(['a', 'b', 'c', 'd', 'or']));
+
+let enNarrowConjunction = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'conjunction'});
+
+assertEquals('', enNarrowConjunction.format());
+assertEquals('', enNarrowConjunction.format([]));
+assertEquals('a', enNarrowConjunction.format(['a']));
+assertEquals('b', enNarrowConjunction.format(['b']));
+assertEquals('a and b', enNarrowConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enNarrowConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enNarrowConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enNarrowConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enNarrowDisjunction = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'disjunction'});
+
+assertEquals('', enNarrowDisjunction.format());
+assertEquals('', enNarrowDisjunction.format([]));
+assertEquals('a', enNarrowDisjunction.format(['a']));
+assertEquals('b', enNarrowDisjunction.format(['b']));
+assertEquals('a or b', enNarrowDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enNarrowDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enNarrowDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enNarrowDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enNarrowUnit = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'unit'});
+
+assertEquals('', enNarrowUnit.format());
+assertEquals('', enNarrowUnit.format([]));
+assertEquals('a', enNarrowUnit.format(['a']));
+assertEquals('b', enNarrowUnit.format(['b']));
+assertEquals('a b', enNarrowUnit.format(['a', 'b']));
+assertEquals('a b c', enNarrowUnit.format(['a', 'b', 'c']));
+assertEquals('a b c d', enNarrowUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a b c d or', enNarrowUnit.format(['a', 'b', 'c', 'd', 'or']));
diff --git a/deps/v8/test/intl/list-format/format-to-parts.js b/deps/v8/test/intl/list-format/format-to-parts.js
new file mode 100644
index 0000000000..83473b6d0b
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format-to-parts.js
@@ -0,0 +1,92 @@
+// Copyright 2018 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-list-format
+
+function assertListFormat(listFormat, input) {
+ var result;
+ try {
+ result = listFormat.formatToParts(input);
+ } catch (e) {
+ fail('should not throw exception ' + e);
+ }
+ assertTrue(Array.isArray(result));
+ if (input) {
+ assertTrue(result.length >= input.length * 2 - 1);
+ for (var i = 0, j = 0; i < result.length; i++) {
+ assertEquals('string', typeof result[i].value);
+ assertEquals('string', typeof result[i].type);
+ assertTrue(result[i].type == 'literal' || result[i].type == 'element');
+ if (result[i].type == 'element') {
+ assertEquals(String(input[j++]), result[i].value);
+ if (i - 1 >= 0) {
+ assertEquals('literal', result[i - 1].type);
+ }
+ if (i + 1 < result.length) {
+ assertEquals('literal', result[i + 1].type);
+ }
+ }
+ if (result[i].type == 'literal') {
+ assertTrue(result[i].value.length > 0);
+ if (i - 1 >= 0) {
+ assertEquals('element', result[i - 1].type);
+ }
+ if (i + 1 < result.length) {
+ assertEquals('element', result[i + 1].type);
+ }
+ }
+ }
+ }
+}
+
+function testFormatter(listFormat) {
+
+ assertListFormat(listFormat, []);
+ assertListFormat(listFormat, undefined);
+ assertListFormat(listFormat, ['1']);
+ assertListFormat(listFormat, ['a']);
+ assertListFormat(listFormat, ['1', 'b']);
+ assertListFormat(listFormat, ['1', 'b', '3']);
+ assertListFormat(listFormat, ['a', 'b']);
+ assertListFormat(listFormat, ['a', 'b', 'c']);
+ assertListFormat(listFormat, ['a', 'b', 'c', 'd']);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', (new Date()).toString()]);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', 'b', '3']);
+ // Tricky cases
+ assertListFormat(listFormat, [' ', 'b', 'c', 'and']);
+ assertListFormat(listFormat, [' ', 'b', 'c', 'or']);
+ assertListFormat(listFormat, ['and']);
+ assertListFormat(listFormat, ['or']);
+
+ assertThrows(() => listFormat.formatToParts(null), TypeError);
+ assertThrows(() => listFormat.formatToParts([new Date()]), TypeError);
+ assertThrows(() => listFormat.formatToParts([1]), TypeError);
+ assertThrows(() => listFormat.formatToParts([1, 'b']), TypeError);
+ assertThrows(() => listFormat.formatToParts([1, 'b', 3]), TypeError);
+ assertThrows(() => listFormat.formatToParts([[3, 4]]), TypeError);
+ assertThrows(() => listFormat.formatToParts([undefined, 'world']), TypeError);
+ assertThrows(() => listFormat.formatToParts(['hello', undefined]), TypeError);
+ assertThrows(() => listFormat.formatToParts([undefined]), TypeError);
+ assertThrows(() => listFormat.formatToParts([null, 'world']), TypeError);
+ assertThrows(() => listFormat.formatToParts(['hello', null]), TypeError);
+ assertThrows(() => listFormat.formatToParts([null]), TypeError);
+
+}
+testFormatter(new Intl.ListFormat());
+testFormatter(new Intl.ListFormat(["en"]));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'unit'}));
diff --git a/deps/v8/test/intl/list-format/format.js b/deps/v8/test/intl/list-format/format.js
new file mode 100644
index 0000000000..677cb22496
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format.js
@@ -0,0 +1,63 @@
+// Copyright 2018 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-list-format
+
+function assertListFormat(listFormat, input) {
+ try {
+ let result = listFormat.format(input);
+ assertEquals('string', typeof result);
+ if (input) {
+ for (var i = 0; i < input.length; i++) {
+ assertTrue(result.indexOf(input[i]) >= 0);
+ }
+ }
+ } catch (e) {
+ fail('should not throw exception ' + e);
+ }
+}
+
+function testFormatter(listFormat) {
+ assertListFormat(listFormat, []);
+ assertListFormat(listFormat, undefined);
+ assertListFormat(listFormat, ['1']);
+ assertListFormat(listFormat, ['a']);
+ assertListFormat(listFormat, ['1', 'b']);
+ assertListFormat(listFormat, ['1', 'b', '3']);
+ assertListFormat(listFormat, ['a', 'b']);
+ assertListFormat(listFormat, ['a', 'b', 'c']);
+ assertListFormat(listFormat, ['a', 'b', 'c', 'd']);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', (new Date()).toString()]);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', 'b', '3']);
+
+ assertThrows(() => listFormat.format(null), TypeError);
+ assertThrows(() => listFormat.format([new Date()]), TypeError);
+ assertThrows(() => listFormat.format([1]), TypeError);
+ assertThrows(() => listFormat.format([1, 'b']), TypeError);
+ assertThrows(() => listFormat.format([1, 'b', 3]), TypeError);
+ assertThrows(() => listFormat.format([[3, 4]]), TypeError);
+ assertThrows(() => listFormat.format([undefined, 'world']), TypeError);
+ assertThrows(() => listFormat.format(['hello', undefined]), TypeError);
+ assertThrows(() => listFormat.format([undefined]), TypeError);
+ assertThrows(() => listFormat.format([null, 'world']), TypeError);
+ assertThrows(() => listFormat.format(['hello', null]), TypeError);
+ assertThrows(() => listFormat.format([null]), TypeError);
+}
+testFormatter(new Intl.ListFormat());
+testFormatter(new Intl.ListFormat(["en"]));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'unit'}));
diff --git a/deps/v8/test/intl/list-format/formatToParts-zh.js b/deps/v8/test/intl/list-format/formatToParts-zh.js
new file mode 100644
index 0000000000..a7204b0b29
--- /dev/null
+++ b/deps/v8/test/intl/list-format/formatToParts-zh.js
@@ -0,0 +1,157 @@
+// Copyright 2018 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-list-format
+
+// The following test are not part of the comformance. Just some output in
+// Chinese to verify the format does return something reasonable for Chinese.
+// It may be changed when we update the CLDR data.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-list-time/
+
+let zhLongConjunction = new Intl.ListFormat(
+ ["zh"], {style: "long", type: 'conjunction'});
+
+var parts;
+parts = zhLongConjunction.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhLongConjunction.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhLongConjunction.formatToParts(['譚永鋒']);
+assertEquals(1, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhLongConjunction.formatToParts(['譚永鋒', '劉新宇']);
+assertEquals(3, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('和', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('劉新宇', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhLongConjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇']);
+assertEquals(5, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('和', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+
+parts = zhLongConjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇', '朱君毅']);
+assertEquals(7, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('、', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+assertEquals('和', parts[5].value);
+assertEquals('literal', parts[5].type);
+assertEquals('朱君毅', parts[6].value);
+assertEquals('element', parts[6].type);
+
+let zhShortDisjunction = new Intl.ListFormat(
+ ["zh"], {style: "short", type: 'disjunction'});
+parts = zhShortDisjunction.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhShortDisjunction.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhShortDisjunction.formatToParts(['譚永鋒']);
+assertEquals(1, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhShortDisjunction.formatToParts(['譚永鋒', '劉新宇']);
+assertEquals(3, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('或', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('劉新宇', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhShortDisjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇']);
+assertEquals(5, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('或', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+
+parts = zhShortDisjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇', '朱君毅']);
+assertEquals(7, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('、', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+assertEquals('或', parts[5].value);
+assertEquals('literal', parts[5].type);
+assertEquals('朱君毅', parts[6].value);
+
+let zhNarrowUnit = new Intl.ListFormat(
+ ["zh"], {style: "narrow", type: 'unit'});
+
+parts = zhNarrowUnit.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhNarrowUnit.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhNarrowUnit.formatToParts(['3英哩']);
+assertEquals(1, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼']);
+assertEquals(2, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼', '5英尺']);
+assertEquals(3, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+assertEquals('5英尺', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼', '5英尺','7英吋']);
+assertEquals(4, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+assertEquals('5英尺', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('7英吋', parts[3].value);
+assertEquals('element', parts[3].type);
diff --git a/deps/v8/test/intl/list-format/resolved-options.js b/deps/v8/test/intl/list-format/resolved-options.js
new file mode 100644
index 0000000000..270eb33e45
--- /dev/null
+++ b/deps/v8/test/intl/list-format/resolved-options.js
@@ -0,0 +1,155 @@
+// Copyright 2018 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-list-format
+
+let listFormat = new Intl.ListFormat();
+// The default style is 'long'
+assertEquals('long', listFormat.resolvedOptions().style);
+
+// The default type is 'conjunction'
+assertEquals('conjunction', listFormat.resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'short'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'narrow'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'long'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {type: 'conjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'conjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['ar'])).resolvedOptions().locale);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['ar', 'en'])).resolvedOptions().locale);
+
+assertEquals(
+ 'fr',
+ (new Intl.ListFormat(['fr', 'en'])).resolvedOptions().locale);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['xyz', 'ar'])).resolvedOptions().locale);
+
+// The following is not working yet because it depend on the getAvailableLocales
+// work in another path set.
+// TODO(ftang): uncomment the following once that patchset is checked in.
+// assertEquals(
+// 'ar',
+// (new Intl.ListFormat(['i-default', 'ar'])).resolvedOptions().locale);
diff --git a/deps/v8/test/intl/locale/locale-constructor.js b/deps/v8/test/intl/locale/locale-constructor.js
index 170cc81c36..3da9e291be 100644
--- a/deps/v8/test/intl/locale/locale-constructor.js
+++ b/deps/v8/test/intl/locale/locale-constructor.js
@@ -9,6 +9,11 @@ assertThrows(() => Intl.Locale('sr'), TypeError);
// Non-string locale.
assertThrows(() => new Intl.Locale(5), TypeError);
+assertThrows(() => new Intl.Locale(Symbol()), TypeError);
+assertThrows(() => new Intl.Locale(null), TypeError);
+assertThrows(() => new Intl.Locale(undefined), TypeError);
+assertThrows(() => new Intl.Locale(false), TypeError);
+assertThrows(() => new Intl.Locale(true), TypeError);
// Invalid locale string.
assertThrows(() => new Intl.Locale('abcdefghi'), RangeError);
diff --git a/deps/v8/test/intl/locale/maximize_minimize.js b/deps/v8/test/intl/locale/maximize_minimize.js
new file mode 100644
index 0000000000..823a6670e3
--- /dev/null
+++ b/deps/v8/test/intl/locale/maximize_minimize.js
@@ -0,0 +1,138 @@
+// Copyright 2018 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-locale
+
+// Make sure that maximize and minimize of all locales work reasonbly.
+
+assertEquals(new Intl.Locale("zh-TW").maximize().toString(), "zh-Hant-TW",
+ "zh-TW should maximize to zh-Hant-TW");
+assertEquals(new Intl.Locale("zh-Hant-TW").minimize().toString(), "zh-TW",
+ "zh-Hant-TW should minimize to zh-TW");
+assertEquals(new Intl.Locale("zh-Hans-CN").minimize().toString(), "zh",
+ "zh-Hans-CN should minimize to zh");
+assertEquals(new Intl.Locale("zh-CN").minimize().toString(), "zh",
+ "zh-CN should minimize to zh");
+assertEquals(new Intl.Locale("zh-Hans").minimize().toString(), "zh",
+ "zh-Hans should minimize to zh");
+
+function assertExpandRoundTrip(loc) {
+ assertEquals(
+ loc.toString(), loc.maximize().minimize().toString(), loc.toString());
+ assertEquals(
+ loc.toString(), loc.minimize().toString(), loc.toString());
+ assertTrue(
+ loc.maximize().toString().length > loc.toString().length, loc.toString());
+}
+
+var simpleLocales = [
+ "af", "agq", "ak", "am", "ar", "asa", "ast", "as", "az", "bas", "bem", "be",
+ "bez", "bg", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ccp", "ce", "cgg",
+ "chr", "ckb", "cs", "cu", "cy", "dav", "da", "de", "dje", "dsb", "dua", "dyo",
+ "dz", "ebu", "ee", "el", "en", "eo", "es", "et", "eu", "ewo", "fa", "ff",
+ "fil", "fi", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guz",
+ "gv", "haw", "ha", "he", "hi", "hr", "hsb", "hu", "hy", "id", "ig", "ii",
+ "is", "it", "ja", "jgo", "jmc", "kab", "kam", "ka", "kde", "kea", "khq", "ki",
+ "kkj", "kk", "kln", "kl", "km", "kn", "kok", "ko", "ksb", "ksf", "ksh", "ks",
+ "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "lo", "lrc", "lt", "luo", "lu",
+ "luy", "lv", "mas", "mer", "mfe", "mgh", "mgo", "mg", "mk", "ml", "mn", "mr",
+ "ms", "mt", "mua", "my", "mzn", "naq", "nb", "nds", "nd", "ne", "nl", "nmg",
+ "nnh", "nn", "nus", "nyn", "om", "or", "os", "pa", "pl", "prg", "ps", "pt",
+ "qu", "rm", "rn", "rof", "ro", "ru", "rwk", "rw", "sah", "saq", "sbp", "sd",
+ "seh", "ses", "se", "sg", "shi", "si", "sk", "sl", "smn", "sn", "so", "sq",
+ "sr", "sv", "sw", "ta", "teo", "te", "tg", "th", "ti", "tk", "to", "tr", "tt",
+ "twq", "tzm", "ug", "uk", "ur", "uz", "vai", "vi", "vo", "vun", "wae", "wo",
+ "xog", "yav", "yi", "yo", "yue", "zgh", "zh", "zu"];
+for (var i = 0; i < simpleLocales.length; i++) {
+ assertExpandRoundTrip(new Intl.Locale(simpleLocales[i]));
+}
+
+function assertReduceRoundTrip(loc) {
+ assertEquals(
+ loc.minimize().toString(), loc.maximize().minimize().toString(),
+ loc.toString());
+ assertEquals(
+ loc.maximize().toString(), loc.minimize().maximize().toString(),
+ loc.toString());
+ assertTrue(
+ loc.maximize().toString().length >= loc.toString().length, loc.toString());
+ assertTrue(
+ loc.minimize().toString().length <= loc.toString().length, loc.toString());
+}
+
+var complexLocales = [
+ "af-NA", "af-ZA", "agq-CM", "ak-GH", "am-ET", "ar-001", "ar-AE", "ar-BH",
+ "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO",
+ "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS",
+ "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN",
+ "ar-YE", "asa-TZ", "as-IN", "ast-ES", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
+ "az-Latn", "bas-CM", "be-BY", "bem-ZM", "bez-TZ", "bg-BG", "bm-ML", "bn-BD",
+ "bn-IN", "bo-CN", "bo-IN", "br-FR", "brx-IN", "bs-Cyrl-BA", "bs-Cyrl",
+ "bs-Latn-BA", "bs-Latn", "ca-AD", "ca-ES", "ca-FR", "ca-IT",
+ "ccp-BD", "ccp-IN", "ce-RU", "cgg-UG", "chr-US", "ckb-Arab-IQ", "ckb-Arab-IR",
+ "ckb-Arab", "ckb-IQ", "ckb-IR", "ckb-Latn-IQ", "ckb-Latn", "cs-CZ", "cu-RU",
+ "cy-GB", "da-DK", "da-GL", "dav-KE", "de-AT", "de-BE", "de-CH", "de-DE",
+ "de-IT", "de-LI", "de-LU", "dje-NE", "dsb-DE", "dua-CM", "dyo-SN", "dz-BT",
+ "ebu-KE", "ee-GH", "ee-TG", "el-CY", "el-GR", "en-001", "en-150", "en-AG",
+ "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM",
+ "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM",
+ "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI",
+ "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI",
+ "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN",
+ "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC",
+ "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT",
+ "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR",
+ "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW",
+ "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI",
+ "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT",
+ "en-TV", "en-TZ", "en-UG", "en-UM", "en-US", "en-VC",
+ "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo-001",
+ "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR",
+ "es-CU", "es-DO", "es-EA", "es-EC", "es-ES", "es-GQ", "es-GT", "es-HN",
+ "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY",
+ "es-SV", "es-US", "es-UY", "es-VE", "et-EE", "eu-ES", "ewo-CM", "fa-AF",
+ "fa-IR", "ff-CM", "ff-GN", "ff-MR", "ff-SN", "fi-FI", "fil-PH", "fo-DK",
+ "fo-FO", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD",
+ "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-FR",
+ "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU",
+ "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU",
+ "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN",
+ "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fur-IT",
+ "fy-NL", "ga-IE", "gd-GB", "gl-ES", "gsw-CH", "gsw-FR", "gsw-LI", "gu-IN",
+ "guz-KE", "gv-IM", "ha-GH", "ha-NE", "ha-NG", "haw-US", "he-IL", "hi-IN",
+ "hr-BA", "hr-HR", "hsb-DE", "hu-HU", "hy-AM", "id-ID", "ig-NG", "ii-CN",
+ "is-IS", "it-CH", "it-IT", "it-SM", "it-VA", "ja-JP", "jgo-CM", "jmc-TZ",
+ "kab-DZ", "ka-GE", "kam-KE", "kde-TZ", "kea-CV", "khq-ML", "ki-KE",
+ "kkj-CM", "kk-KZ", "kl-GL", "kln-KE", "km-KH", "kn-IN", "kok-IN", "ko-KP",
+ "ko-KR", "ksb-TZ", "ksf-CM", "ksh-DE", "ks-IN", "kw-GB", "ky-KG", "lag-TZ",
+ "lb-LU", "lg-UG", "lkt-US", "ln-AO", "ln-CD", "ln-CF", "ln-CG", "lo-LA",
+ "lrc-IQ", "lrc-IR", "lt-LT", "lu-CD", "luo-KE", "luy-KE", "lv-LV", "mas-KE",
+ "mas-TZ", "mer-KE", "mfe-MU", "mgh-MZ", "mg-MG", "mgo-CM", "mk-MK", "ml-IN",
+ "mn-MN", "mr-IN", "ms-BN", "ms-MY", "ms-SG", "mt-MT", "mua-CM", "my-MM",
+ "mzn-IR", "naq-NA", "nb-NO", "nb-SJ", "nds-DE", "nds-NL", "nd-ZW", "ne-IN",
+ "ne-NP", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-NL", "nl-SR", "nl-SX",
+ "nmg-CM", "nnh-CM", "nn-NO", "nus-SS", "nyn-UG", "om-ET", "om-KE",
+ "or-IN", "os-GE", "os-RU", "pa-Arab-PK", "pa-Guru-IN", "pa-Guru",
+ "pl-PL", "prg-001", "ps-AF", "pt-AO", "pt-BR", "pt-CH", "pt-CV", "pt-GQ",
+ "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu-BO",
+ "qu-EC", "qu-PE", "rm-CH", "rn-BI", "rof-TZ", "ro-MD", "ro-RO", "ru-BY",
+ "ru-KG", "ru-KZ", "ru-MD", "ru-RU", "ru-UA", "rwk-TZ", "rw-RW", "sah-RU",
+ "saq-KE", "sbp-TZ", "sd-PK", "se-FI", "seh-MZ", "se-NO", "se-SE", "ses-ML",
+ "sg-CF", "shi-Latn-MA", "shi-Latn", "shi-Tfng-MA", "shi-Tfng", "si-LK",
+ "sk-SK", "sl-SI", "smn-FI", "sn-ZW", "so-DJ", "so-ET", "so-KE", "so-SO",
+ "sq-AL", "sq-MK", "sq-XK", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-RS",
+ "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-RS",
+ "sr-Latn-XK", "sr-Latn", "sv-AX", "sv-FI", "sv-SE", "sw-CD", "sw-KE",
+ "sw-TZ", "sw-UG", "ta-IN", "ta-LK", "ta-MY", "ta-SG", "te-IN", "teo-KE",
+ "teo-UG", "tg-TJ", "th-TH", "ti-ER", "ti-ET", "tk-TM", "to-TO", "tr-CY",
+ "tr-TR", "tt-RU", "twq-NE", "tzm-MA", "ug-CN", "uk-UA", "ur-IN", "ur-PK",
+ "uz-Arab-AF", "uz-Cyrl-UZ", "uz-Cyrl", "uz-Latn-UZ", "uz-Latn",
+ "vai-Latn-LR", "vai-Latn", "vai-Vaii-LR", "vai-Vaii", "vi-VN", "vo-001",
+ "vun-TZ", "wae-CH", "wo-SN", "xog-UG", "yav-CM", "yi-001", "yo-BJ", "yo-NG",
+ "yue-Hans-CN", "yue-Hant-HK", "yue-Hant", "zgh-MA", "zh-Hans-CN",
+ "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK",
+ "zh-Hant-MO", "zh-Hant-TW", "zu-ZA"];
+for (var i = 0; i < complexLocales.length; i++) {
+ assertReduceRoundTrip(new Intl.Locale(complexLocales[i]));
+}
diff --git a/deps/v8/test/intl/locale/regress-8032.js b/deps/v8/test/intl/locale/regress-8032.js
new file mode 100644
index 0000000000..b8219b1b50
--- /dev/null
+++ b/deps/v8/test/intl/locale/regress-8032.js
@@ -0,0 +1,7 @@
+// Copyright 2018 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-locale
+
+assertThrows(() => new Intl.Locale(''), RangeError);
diff --git a/deps/v8/test/intl/number-format/options.js b/deps/v8/test/intl/number-format/options.js
new file mode 100644
index 0000000000..80ddc025d1
--- /dev/null
+++ b/deps/v8/test/intl/number-format/options.js
@@ -0,0 +1,13 @@
+// Copyright 2018 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.
+
+assertThrows(() => new Intl.NumberFormat('en', null));
+assertDoesNotThrow(() => new Intl.NumberFormat('en', undefined));
+
+for (let key of [false, true, "foo", Symbol, 1]) {
+ assertDoesNotThrow(() => new Intl.NumberFormat('en', key));
+}
+
+assertDoesNotThrow(() => new Intl.NumberFormat('en', {}));
+assertDoesNotThrow(() => new Intl.NumberFormat('en', new Proxy({}, {})));
diff --git a/deps/v8/test/intl/regress-8030.js b/deps/v8/test/intl/regress-8030.js
new file mode 100644
index 0000000000..eac6b84f81
--- /dev/null
+++ b/deps/v8/test/intl/regress-8030.js
@@ -0,0 +1,21 @@
+// Copyright 2018 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-relative-time-format
+
+var locales = ["tlh", "id", "en"];
+var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales);
+var referenceFormatted = referenceRelativeTimeFormat.format(3, "day");
+
+class MyFormat extends Intl.RelativeTimeFormat {
+ constructor(locales, options) {
+ super(locales, options);
+ // could initialize MyRelativeTimeFormat properties
+ }
+ // could add methods to MyRelativeTimeFormat.prototype
+}
+
+var format = new MyFormat(locales);
+var actual = format.format(3, "day");
+assertEquals(actual, referenceFormatted);
diff --git a/deps/v8/test/intl/regress-8031.js b/deps/v8/test/intl/regress-8031.js
new file mode 100644
index 0000000000..0898026d99
--- /dev/null
+++ b/deps/v8/test/intl/regress-8031.js
@@ -0,0 +1,22 @@
+// Copyright 2018 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-list-format
+
+var locales = ["tlh", "id", "en"];
+var input = ["a", "b", "c"];
+var referenceListFormat = new Intl.ListFormat(locales);
+var referenceFormatted = referenceListFormat.format(input);
+
+class MyFormat extends Intl.ListFormat {
+ constructor(locales, options) {
+ super(locales, options);
+ // could initialize MyListFormat properties
+ }
+ // could add methods to MyListFormat.prototype
+}
+
+var format = new MyFormat(locales);
+var actual = format.format(input);
+assertEquals(actual, referenceFormatted);
diff --git a/deps/v8/test/intl/regress-8725514.js b/deps/v8/test/intl/regress-8725514.js
new file mode 100644
index 0000000000..82f884a093
--- /dev/null
+++ b/deps/v8/test/intl/regress-8725514.js
@@ -0,0 +1,10 @@
+// Copyright 2018 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.
+
+Object.prototype.__defineGetter__('x', function () {
+ return -2147483648;
+ });
+
+var f = ["x-u-foo"];
+Intl.NumberFormat(f);
diff --git a/deps/v8/test/intl/regress-875643.js b/deps/v8/test/intl/regress-875643.js
new file mode 100644
index 0000000000..2625c8110f
--- /dev/null
+++ b/deps/v8/test/intl/regress-875643.js
@@ -0,0 +1,5 @@
+// Copyright 2018 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.
+
+new Intl.NumberFormat(undefined, false)
diff --git a/deps/v8/test/intl/relative-time-format/format-en.js b/deps/v8/test/intl/relative-time-format/format-en.js
new file mode 100644
index 0000000000..cd58d65355
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-en.js
@@ -0,0 +1,502 @@
+// Copyright 2018 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-relative-time-format
+
+// The following test are not part of the comformance. Just some output in
+// English to verify the format does return something reasonable for English.
+// It may be changed when we update the CLDR data.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-relative-time/
+
+let longAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 seconds ago', longAuto.format(-3, 'second'));
+assertEquals('2 seconds ago', longAuto.format(-2, 'second'));
+assertEquals('1 second ago', longAuto.format(-1, 'second'));
+assertEquals('now', longAuto.format(0, 'second'));
+assertEquals('now', longAuto.format(-0, 'second'));
+assertEquals('in 1 second', longAuto.format(1, 'second'));
+assertEquals('in 2 seconds', longAuto.format(2, 'second'));
+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('in 1 minute', longAuto.format(1, 'minute'));
+assertEquals('in 2 minutes', longAuto.format(2, 'minute'));
+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('in 1 hour', longAuto.format(1, 'hour'));
+assertEquals('in 2 hours', longAuto.format(2, 'hour'));
+assertEquals('in 345 hours', longAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', longAuto.format(-3, 'day'));
+assertEquals('2 days ago', longAuto.format(-2, 'day'));
+assertEquals('yesterday', longAuto.format(-1, 'day'));
+assertEquals('today', longAuto.format(0, 'day'));
+assertEquals('today', longAuto.format(-0, 'day'));
+assertEquals('tomorrow', longAuto.format(1, 'day'));
+assertEquals('in 2 days', longAuto.format(2, 'day'));
+assertEquals('in 345 days', longAuto.format(345, 'day'));
+
+assertEquals('3 weeks ago', longAuto.format(-3, 'week'));
+assertEquals('2 weeks ago', longAuto.format(-2, 'week'));
+assertEquals('last week', longAuto.format(-1, 'week'));
+assertEquals('this week', longAuto.format(0, 'week'));
+assertEquals('this week', longAuto.format(-0, 'week'));
+assertEquals('next week', longAuto.format(1, 'week'));
+assertEquals('in 2 weeks', longAuto.format(2, 'week'));
+assertEquals('in 345 weeks', longAuto.format(345, 'week'));
+
+assertEquals('3 months ago', longAuto.format(-3, 'month'));
+assertEquals('2 months ago', longAuto.format(-2, 'month'));
+assertEquals('last month', longAuto.format(-1, 'month'));
+assertEquals('this month', longAuto.format(0, 'month'));
+assertEquals('this month', longAuto.format(-0, 'month'));
+assertEquals('next month', longAuto.format(1, 'month'));
+assertEquals('in 2 months', longAuto.format(2, 'month'));
+assertEquals('in 345 months', longAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+// Tracked by ICU bug in http://bugs.icu-project.org/trac/ticket/12171
+/*
+assertEquals('3 quarters ago', longAuto.format(-3, 'quarter'));
+assertEquals('2 quarters ago', longAuto.format(-2, 'quarter'));
+assertEquals('last quarter', longAuto.format(-1, 'quarter'));
+assertEquals('this quarter', longAuto.format(0, 'quarter'));
+assertEquals('this quarter', longAuto.format(-0, 'quarter'));
+assertEquals('next quarter', longAuto.format(1, 'quarter'));
+assertEquals('in 2 quarters', longAuto.format(2, 'quarter'));
+assertEquals('in 345 quarters', longAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 years ago', longAuto.format(-3, 'year'));
+assertEquals('2 years ago', longAuto.format(-2, 'year'));
+assertEquals('last year', longAuto.format(-1, 'year'));
+assertEquals('this year', longAuto.format(0, 'year'));
+assertEquals('this year', longAuto.format(-0, 'year'));
+assertEquals('next year', longAuto.format(1, 'year'));
+assertEquals('in 2 years', longAuto.format(2, 'year'));
+assertEquals('in 345 years', longAuto.format(345, 'year'));
+
+let shortAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "short", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 sec. ago', shortAuto.format(-3, 'second'));
+assertEquals('2 sec. ago', shortAuto.format(-2, 'second'));
+assertEquals('1 sec. ago', shortAuto.format(-1, 'second'));
+assertEquals('now', shortAuto.format(0, 'second'));
+assertEquals('now', shortAuto.format(-0, 'second'));
+assertEquals('in 1 sec.', shortAuto.format(1, 'second'));
+assertEquals('in 2 sec.', shortAuto.format(2, 'second'));
+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('in 1 min.', shortAuto.format(1, 'minute'));
+assertEquals('in 2 min.', shortAuto.format(2, 'minute'));
+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('in 1 hr.', shortAuto.format(1, 'hour'));
+assertEquals('in 2 hr.', shortAuto.format(2, 'hour'));
+assertEquals('in 345 hr.', shortAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', shortAuto.format(-3, 'day'));
+assertEquals('2 days ago', shortAuto.format(-2, 'day'));
+assertEquals('yesterday', shortAuto.format(-1, 'day'));
+assertEquals('today', shortAuto.format(0, 'day'));
+assertEquals('today', shortAuto.format(-0, 'day'));
+assertEquals('tomorrow', shortAuto.format(1, 'day'));
+assertEquals('in 2 days', shortAuto.format(2, 'day'));
+assertEquals('in 345 days', shortAuto.format(345, 'day'));
+
+assertEquals('3 wk. ago', shortAuto.format(-3, 'week'));
+assertEquals('2 wk. ago', shortAuto.format(-2, 'week'));
+assertEquals('last wk.', shortAuto.format(-1, 'week'));
+assertEquals('this wk.', shortAuto.format(0, 'week'));
+assertEquals('this wk.', shortAuto.format(-0, 'week'));
+assertEquals('next wk.', shortAuto.format(1, 'week'));
+assertEquals('in 2 wk.', shortAuto.format(2, 'week'));
+assertEquals('in 345 wk.', shortAuto.format(345, 'week'));
+
+assertEquals('3 mo. ago', shortAuto.format(-3, 'month'));
+assertEquals('2 mo. ago', shortAuto.format(-2, 'month'));
+assertEquals('last mo.', shortAuto.format(-1, 'month'));
+assertEquals('this mo.', shortAuto.format(0, 'month'));
+assertEquals('this mo.', shortAuto.format(-0, 'month'));
+assertEquals('next mo.', shortAuto.format(1, 'month'));
+assertEquals('in 2 mo.', shortAuto.format(2, 'month'));
+assertEquals('in 345 mo.', shortAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', shortAuto.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', shortAuto.format(-2, 'quarter'));
+assertEquals('last qtr.', shortAuto.format(-1, 'quarter'));
+assertEquals('this qtr.', shortAuto.format(0, 'quarter'));
+assertEquals('this qtr.', shortAuto.format(-0, 'quarter'));
+assertEquals('next qtr.', shortAuto.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', shortAuto.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', shortAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', shortAuto.format(-3, 'year'));
+assertEquals('2 yr. ago', shortAuto.format(-2, 'year'));
+assertEquals('last yr.', shortAuto.format(-1, 'year'));
+assertEquals('this yr.', shortAuto.format(0, 'year'));
+assertEquals('this yr.', shortAuto.format(-0, 'year'));
+assertEquals('next yr.', shortAuto.format(1, 'year'));
+assertEquals('in 2 yr.', shortAuto.format(2, 'year'));
+assertEquals('in 345 yr.', shortAuto.format(345, 'year'));
+
+// Somehow in the 'en' locale, there are no valeu for -narrow
+let narrowAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "narrow", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 sec. ago', narrowAuto.format(-3, 'second'));
+assertEquals('2 sec. ago', narrowAuto.format(-2, 'second'));
+assertEquals('1 sec. ago', narrowAuto.format(-1, 'second'));
+assertEquals('now', narrowAuto.format(0, 'second'));
+assertEquals('now', narrowAuto.format(-0, 'second'));
+assertEquals('in 1 sec.', narrowAuto.format(1, 'second'));
+assertEquals('in 2 sec.', narrowAuto.format(2, 'second'));
+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('in 1 min.', narrowAuto.format(1, 'minute'));
+assertEquals('in 2 min.', narrowAuto.format(2, 'minute'));
+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('in 1 hr.', narrowAuto.format(1, 'hour'));
+assertEquals('in 2 hr.', narrowAuto.format(2, 'hour'));
+assertEquals('in 345 hr.', narrowAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', narrowAuto.format(-3, 'day'));
+assertEquals('2 days ago', narrowAuto.format(-2, 'day'));
+assertEquals('yesterday', narrowAuto.format(-1, 'day'));
+assertEquals('today', narrowAuto.format(0, 'day'));
+assertEquals('today', narrowAuto.format(-0, 'day'));
+assertEquals('tomorrow', narrowAuto.format(1, 'day'));
+assertEquals('in 2 days', narrowAuto.format(2, 'day'));
+assertEquals('in 345 days', narrowAuto.format(345, 'day'));
+
+assertEquals('3 wk. ago', narrowAuto.format(-3, 'week'));
+assertEquals('2 wk. ago', narrowAuto.format(-2, 'week'));
+assertEquals('last wk.', narrowAuto.format(-1, 'week'));
+assertEquals('this wk.', narrowAuto.format(0, 'week'));
+assertEquals('this wk.', narrowAuto.format(-0, 'week'));
+assertEquals('next wk.', narrowAuto.format(1, 'week'));
+assertEquals('in 2 wk.', narrowAuto.format(2, 'week'));
+assertEquals('in 345 wk.', narrowAuto.format(345, 'week'));
+
+assertEquals('3 mo. ago', narrowAuto.format(-3, 'month'));
+assertEquals('2 mo. ago', narrowAuto.format(-2, 'month'));
+assertEquals('last mo.', narrowAuto.format(-1, 'month'));
+assertEquals('this mo.', narrowAuto.format(0, 'month'));
+assertEquals('this mo.', narrowAuto.format(-0, 'month'));
+assertEquals('next mo.', narrowAuto.format(1, 'month'));
+assertEquals('in 2 mo.', narrowAuto.format(2, 'month'));
+assertEquals('in 345 mo.', narrowAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', narrowAuto.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', narrowAuto.format(-2, 'quarter'));
+assertEquals('last qtr.', narrowAuto.format(-1, 'quarter'));
+assertEquals('this qtr.', narrowAuto.format(0, 'quarter'));
+assertEquals('this qtr.', narrowAuto.format(-0, 'quarter'));
+assertEquals('next qtr.', narrowAuto.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', narrowAuto.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', narrowAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', narrowAuto.format(-3, 'year'));
+assertEquals('2 yr. ago', narrowAuto.format(-2, 'year'));
+assertEquals('last yr.', narrowAuto.format(-1, 'year'));
+assertEquals('this yr.', narrowAuto.format(0, 'year'));
+assertEquals('this yr.', narrowAuto.format(-0, 'year'));
+assertEquals('next yr.', narrowAuto.format(1, 'year'));
+assertEquals('in 2 yr.', narrowAuto.format(2, 'year'));
+assertEquals('in 345 yr.', narrowAuto.format(345, 'year'));
+
+let longAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 seconds ago', longAlways.format(-3, 'second'));
+assertEquals('2 seconds ago', longAlways.format(-2, 'second'));
+assertEquals('1 second ago', longAlways.format(-1, 'second'));
+assertEquals('in 0 seconds', longAlways.format(0, 'second'));
+assertEquals('0 seconds ago', longAlways.format(-0, 'second'));
+assertEquals('in 1 second', longAlways.format(1, 'second'));
+assertEquals('in 2 seconds', longAlways.format(2, 'second'));
+assertEquals('in 345 seconds', longAlways.format(345, 'second'));
+
+assertEquals('3 minutes ago', longAlways.format(-3, 'minute'));
+assertEquals('2 minutes ago', longAlways.format(-2, 'minute'));
+assertEquals('1 minute ago', longAlways.format(-1, 'minute'));
+assertEquals('in 0 minutes', longAlways.format(0, 'minute'));
+assertEquals('0 minutes ago', longAlways.format(-0, 'minute'));
+assertEquals('in 1 minute', longAlways.format(1, 'minute'));
+assertEquals('in 2 minutes', longAlways.format(2, 'minute'));
+assertEquals('in 345 minutes', longAlways.format(345, 'minute'));
+
+assertEquals('3 hours ago', longAlways.format(-3, 'hour'));
+assertEquals('2 hours ago', longAlways.format(-2, 'hour'));
+assertEquals('1 hour ago', longAlways.format(-1, 'hour'));
+assertEquals('in 0 hours', longAlways.format(0, 'hour'));
+assertEquals('0 hours ago', longAlways.format(-0, 'hour'));
+assertEquals('in 1 hour', longAlways.format(1, 'hour'));
+assertEquals('in 2 hours', longAlways.format(2, 'hour'));
+assertEquals('in 345 hours', longAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', longAlways.format(-3, 'day'));
+assertEquals('2 days ago', longAlways.format(-2, 'day'));
+assertEquals('1 day ago', longAlways.format(-1, 'day'));
+assertEquals('in 0 days', longAlways.format(0, 'day'));
+assertEquals('0 days ago', longAlways.format(-0, 'day'));
+assertEquals('in 1 day', longAlways.format(1, 'day'));
+assertEquals('in 2 days', longAlways.format(2, 'day'));
+assertEquals('in 345 days', longAlways.format(345, 'day'));
+
+assertEquals('3 weeks ago', longAlways.format(-3, 'week'));
+assertEquals('2 weeks ago', longAlways.format(-2, 'week'));
+assertEquals('1 week ago', longAlways.format(-1, 'week'));
+assertEquals('in 0 weeks', longAlways.format(0, 'week'));
+assertEquals('0 weeks ago', longAlways.format(-0, 'week'));
+assertEquals('in 1 week', longAlways.format(1, 'week'));
+assertEquals('in 2 weeks', longAlways.format(2, 'week'));
+assertEquals('in 345 weeks', longAlways.format(345, 'week'));
+
+assertEquals('3 months ago', longAlways.format(-3, 'month'));
+assertEquals('2 months ago', longAlways.format(-2, 'month'));
+assertEquals('1 month ago', longAlways.format(-1, 'month'));
+assertEquals('in 0 months', longAlways.format(0, 'month'));
+assertEquals('0 months ago', longAlways.format(-0, 'month'));
+assertEquals('in 1 month', longAlways.format(1, 'month'));
+assertEquals('in 2 months', longAlways.format(2, 'month'));
+assertEquals('in 345 months', longAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 quarters ago', longAlways.format(-3, 'quarter'));
+assertEquals('2 quarters ago', longAlways.format(-2, 'quarter'));
+assertEquals('1 quarter ago', longAlways.format(-1, 'quarter'));
+assertEquals('in 0 quarters', longAlways.format(0, 'quarter'));
+assertEquals('0 quarters ago', longAlways.format(-0, 'quarter'));
+assertEquals('in 1 quarter', longAlways.format(1, 'quarter'));
+assertEquals('in 2 quarters', longAlways.format(2, 'quarter'));
+assertEquals('in 345 quarters', longAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 years ago', longAlways.format(-3, 'year'));
+assertEquals('2 years ago', longAlways.format(-2, 'year'));
+assertEquals('1 year ago', longAlways.format(-1, 'year'));
+assertEquals('in 0 years', longAlways.format(0, 'year'));
+assertEquals('0 years ago', longAlways.format(-0, 'year'));
+assertEquals('in 1 year', longAlways.format(1, 'year'));
+assertEquals('in 2 years', longAlways.format(2, 'year'));
+assertEquals('in 345 years', longAlways.format(345, 'year'));
+
+let shortAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "short", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 sec. ago', shortAlways.format(-3, 'second'));
+assertEquals('2 sec. ago', shortAlways.format(-2, 'second'));
+assertEquals('1 sec. ago', shortAlways.format(-1, 'second'));
+assertEquals('in 0 sec.', shortAlways.format(0, 'second'));
+assertEquals('0 sec. ago', shortAlways.format(-0, 'second'));
+assertEquals('in 1 sec.', shortAlways.format(1, 'second'));
+assertEquals('in 2 sec.', shortAlways.format(2, 'second'));
+assertEquals('in 345 sec.', shortAlways.format(345, 'second'));
+
+assertEquals('3 min. ago', shortAlways.format(-3, 'minute'));
+assertEquals('2 min. ago', shortAlways.format(-2, 'minute'));
+assertEquals('1 min. ago', shortAlways.format(-1, 'minute'));
+assertEquals('in 0 min.', shortAlways.format(0, 'minute'));
+assertEquals('0 min. ago', shortAlways.format(-0, 'minute'));
+assertEquals('in 1 min.', shortAlways.format(1, 'minute'));
+assertEquals('in 2 min.', shortAlways.format(2, 'minute'));
+assertEquals('in 345 min.', shortAlways.format(345, 'minute'));
+
+assertEquals('3 hr. ago', shortAlways.format(-3, 'hour'));
+assertEquals('2 hr. ago', shortAlways.format(-2, 'hour'));
+assertEquals('1 hr. ago', shortAlways.format(-1, 'hour'));
+assertEquals('in 0 hr.', shortAlways.format(0, 'hour'));
+assertEquals('0 hr. ago', shortAlways.format(-0, 'hour'));
+assertEquals('in 1 hr.', shortAlways.format(1, 'hour'));
+assertEquals('in 2 hr.', shortAlways.format(2, 'hour'));
+assertEquals('in 345 hr.', shortAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', shortAlways.format(-3, 'day'));
+assertEquals('2 days ago', shortAlways.format(-2, 'day'));
+assertEquals('1 day ago', shortAlways.format(-1, 'day'));
+assertEquals('in 0 days', shortAlways.format(0, 'day'));
+assertEquals('0 days ago', shortAlways.format(-0, 'day'));
+assertEquals('in 1 day', shortAlways.format(1, 'day'));
+assertEquals('in 2 days', shortAlways.format(2, 'day'));
+assertEquals('in 345 days', shortAlways.format(345, 'day'));
+
+assertEquals('3 wk. ago', shortAlways.format(-3, 'week'));
+assertEquals('2 wk. ago', shortAlways.format(-2, 'week'));
+assertEquals('1 wk. ago', shortAlways.format(-1, 'week'));
+assertEquals('in 0 wk.', shortAlways.format(0, 'week'));
+assertEquals('0 wk. ago', shortAlways.format(-0, 'week'));
+assertEquals('in 1 wk.', shortAlways.format(1, 'week'));
+assertEquals('in 2 wk.', shortAlways.format(2, 'week'));
+assertEquals('in 345 wk.', shortAlways.format(345, 'week'));
+
+assertEquals('3 mo. ago', shortAlways.format(-3, 'month'));
+assertEquals('2 mo. ago', shortAlways.format(-2, 'month'));
+assertEquals('1 mo. ago', shortAlways.format(-1, 'month'));
+assertEquals('in 0 mo.', shortAlways.format(0, 'month'));
+assertEquals('0 mo. ago', shortAlways.format(-0, 'month'));
+assertEquals('in 1 mo.', shortAlways.format(1, 'month'));
+assertEquals('in 2 mo.', shortAlways.format(2, 'month'));
+assertEquals('in 345 mo.', shortAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', shortAlways.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', shortAlways.format(-2, 'quarter'));
+assertEquals('1 qtr. ago', shortAlways.format(-1, 'quarter'));
+assertEquals('in 0 qtrs.', shortAlways.format(0, 'quarter'));
+assertEquals('0 qtr. ago', shortAlways.format(-0, 'quarter'));
+assertEquals('in 1 qtr.', shortAlways.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', shortAlways.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', shortAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', shortAlways.format(-3, 'year'));
+assertEquals('2 yr. ago', shortAlways.format(-2, 'year'));
+assertEquals('1 yr. ago', shortAlways.format(-1, 'year'));
+assertEquals('in 0 yr.', shortAlways.format(0, 'year'));
+assertEquals('0 yr. ago', shortAlways.format(-0, 'year'));
+assertEquals('in 1 yr.', shortAlways.format(1, 'year'));
+assertEquals('in 2 yr.', shortAlways.format(2, 'year'));
+assertEquals('in 345 yr.', shortAlways.format(345, 'year'));
+
+// Somehow in the 'en' locale, there are no valeu for -narrow
+let narrowAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "narrow", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 sec. ago', narrowAlways.format(-3, 'second'));
+assertEquals('2 sec. ago', narrowAlways.format(-2, 'second'));
+assertEquals('1 sec. ago', narrowAlways.format(-1, 'second'));
+assertEquals('in 0 sec.', narrowAlways.format(0, 'second'));
+assertEquals('0 sec. ago', narrowAlways.format(-0, 'second'));
+assertEquals('in 1 sec.', narrowAlways.format(1, 'second'));
+assertEquals('in 2 sec.', narrowAlways.format(2, 'second'));
+assertEquals('in 345 sec.', narrowAlways.format(345, 'second'));
+
+assertEquals('3 min. ago', narrowAlways.format(-3, 'minute'));
+assertEquals('2 min. ago', narrowAlways.format(-2, 'minute'));
+assertEquals('1 min. ago', narrowAlways.format(-1, 'minute'));
+assertEquals('in 0 min.', narrowAlways.format(0, 'minute'));
+assertEquals('0 min. ago', narrowAlways.format(-0, 'minute'));
+assertEquals('in 1 min.', narrowAlways.format(1, 'minute'));
+assertEquals('in 2 min.', narrowAlways.format(2, 'minute'));
+assertEquals('in 345 min.', narrowAlways.format(345, 'minute'));
+
+assertEquals('3 hr. ago', narrowAlways.format(-3, 'hour'));
+assertEquals('2 hr. ago', narrowAlways.format(-2, 'hour'));
+assertEquals('1 hr. ago', narrowAlways.format(-1, 'hour'));
+assertEquals('in 0 hr.', narrowAlways.format(0, 'hour'));
+assertEquals('0 hr. ago', narrowAlways.format(-0, 'hour'));
+assertEquals('in 1 hr.', narrowAlways.format(1, 'hour'));
+assertEquals('in 2 hr.', narrowAlways.format(2, 'hour'));
+assertEquals('in 345 hr.', narrowAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', narrowAlways.format(-3, 'day'));
+assertEquals('2 days ago', narrowAlways.format(-2, 'day'));
+assertEquals('1 day ago', narrowAlways.format(-1, 'day'));
+assertEquals('in 0 days', narrowAlways.format(0, 'day'));
+assertEquals('0 days ago', narrowAlways.format(-0, 'day'));
+assertEquals('in 1 day', narrowAlways.format(1, 'day'));
+assertEquals('in 2 days', narrowAlways.format(2, 'day'));
+assertEquals('in 345 days', narrowAlways.format(345, 'day'));
+
+assertEquals('3 wk. ago', narrowAlways.format(-3, 'week'));
+assertEquals('2 wk. ago', narrowAlways.format(-2, 'week'));
+assertEquals('1 wk. ago', narrowAlways.format(-1, 'week'));
+assertEquals('in 0 wk.', narrowAlways.format(0, 'week'));
+assertEquals('0 wk. ago', narrowAlways.format(-0, 'week'));
+assertEquals('in 1 wk.', narrowAlways.format(1, 'week'));
+assertEquals('in 2 wk.', narrowAlways.format(2, 'week'));
+assertEquals('in 345 wk.', narrowAlways.format(345, 'week'));
+
+assertEquals('3 mo. ago', narrowAlways.format(-3, 'month'));
+assertEquals('2 mo. ago', narrowAlways.format(-2, 'month'));
+assertEquals('1 mo. ago', narrowAlways.format(-1, 'month'));
+assertEquals('in 0 mo.', narrowAlways.format(0, 'month'));
+assertEquals('0 mo. ago', narrowAlways.format(-0, 'month'));
+assertEquals('in 1 mo.', narrowAlways.format(1, 'month'));
+assertEquals('in 2 mo.', narrowAlways.format(2, 'month'));
+assertEquals('in 345 mo.', narrowAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', narrowAlways.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', narrowAlways.format(-2, 'quarter'));
+assertEquals('1 qtr. ago', narrowAlways.format(-1, 'quarter'));
+assertEquals('in 0 qtrs.', narrowAlways.format(0, 'quarter'));
+assertEquals('0 qtr. ago', narrowAlways.format(-0, 'quarter'));
+assertEquals('in 1 qtr.', narrowAlways.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', narrowAlways.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', narrowAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', narrowAlways.format(-3, 'year'));
+assertEquals('2 yr. ago', narrowAlways.format(-2, 'year'));
+assertEquals('1 yr. ago', narrowAlways.format(-1, 'year'));
+assertEquals('in 0 yr.', narrowAlways.format(0, 'year'));
+assertEquals('0 yr. ago', narrowAlways.format(-0, 'year'));
+assertEquals('in 1 yr.', narrowAlways.format(1, 'year'));
+assertEquals('in 2 yr.', narrowAlways.format(2, 'year'));
+assertEquals('in 345 yr.', narrowAlways.format(345, 'year'));
+
+var styleNumericCombinations = [
+ longAuto, shortAuto, narrowAuto, longAlways,
+ shortAlways, narrowAlways ];
+var validUnits = [
+ 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'];
+
+// Test these all throw RangeError
+for (var i = 0; i < styleNumericCombinations.length; i++) {
+ for (var j = 0; j < validUnits.length; j++) {
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j]),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j] + 's'),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j]),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j] + 's'),
+ RangeError);
+ }
+}
diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts-en.js b/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
new file mode 100644
index 0000000000..52a0b885d7
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
@@ -0,0 +1,68 @@
+// Copyright 2018 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-relative-time-format
+
+// The following test are not part of the comformance. Just some output in
+// English to verify the format does return something reasonable for English.
+// It may be changed when we update the CLDR data.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-relative-time/
+
+// From Sample code in https://github.com/tc39/proposal-intl-relative-time#intlrelativetimeformatprototypeformattopartsvalue-unit
+// // Format relative time using the day unit.
+// rtf.formatToParts(-1, "day");
+// // > [{ type: "literal", value: "yesterday"}]
+let longAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'auto'});
+var parts = longAuto.formatToParts(-1, "day");
+assertEquals(1, parts.length);
+assertEquals(2, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('literal', parts[0].type);
+assertEquals('yesterday', parts[0].value);
+
+// From Sample code in https://github.com/tc39/proposal-intl-relative-time#intlrelativetimeformatprototypeformattopartsvalue-unit
+// rtf.formatToParts(100, "day");
+// // > [{ type: "literal", value: "in " }, { type: "integer", value: "100", unit: "day" }, { type: "literal", value: " days" }]
+let longAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'always'});
+
+parts = longAlways.formatToParts(100, "day");
+assertEquals(3, parts.length);
+
+assertEquals(2, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('literal', parts[0].type);
+assertEquals('in ', parts[0].value);
+
+assertEquals(3, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('integer', parts[1].type);
+assertEquals('100', parts[1].value);
+assertEquals('day', parts[1].unit);
+
+assertEquals(2, Object.getOwnPropertyNames(parts[2]).length);
+assertEquals('literal', parts[2].type);
+assertEquals(' days', parts[2].value);
+
+assertThrows(() => longAlways.format(NaN, 'second'), RangeError);
+assertThrows(() => longAuto.format(NaN, 'second'), RangeError);
+
+parts = longAlways.formatToParts(-10, "day");
+assertEquals(2, parts.length);
+assertEquals(3, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('integer', parts[0].type);
+assertEquals('10', parts[0].value);
+assertEquals('day', parts[0].unit);
+assertEquals(2, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('literal', parts[1].type);
+assertEquals(' days ago', parts[1].value);
+
+parts = longAlways.formatToParts(-0, "day");
+assertEquals(2, parts.length);
+assertEquals(3, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('integer', parts[0].type);
+assertEquals('0', parts[0].value);
+assertEquals('day', parts[0].unit);
+assertEquals(2, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('literal', parts[1].type);
+assertEquals(' days ago', parts[1].value);
diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts.js b/deps/v8/test/intl/relative-time-format/format-to-parts.js
new file mode 100644
index 0000000000..071c4468c0
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts.js
@@ -0,0 +1,82 @@
+// Copyright 2018 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-relative-time-format
+
+// Make sure that RelativeTimeFormat exposes all required properties. Those not specified
+// should have undefined value.
+// http://tc39.github.io/proposal-intl-relative-time/
+
+let rtf = new Intl.RelativeTimeFormat();
+
+// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit )
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'seconds')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'second')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minutes')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minute')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hours')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hour')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'days')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'day')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'weeks')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'week')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'months')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'month')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarters')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarter')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'years')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'year')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'seconds')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'second')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minutes')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minute')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hours')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hour')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'days')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'day')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'weeks')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'week')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'months')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'month')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarters')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarter')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'years')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'year')));
+
+assertThrows(() => rtf.formatToParts(-1, 'decades'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'decade'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'centuries'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'century'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'milliseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'millisecond'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'microseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'microsecond'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'nanoseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'nanosecond'), RangeError);
+
+assertThrows(() => rtf.formatToParts(NaN, 'seconds'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'second'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'minutes'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'minute'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'hours'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'hour'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'days'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'day'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'weeks'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'week'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'months'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'month'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'years'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'year'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'quarters'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'quarter'), RangeError);
+
+assertEquals(true, Array.isArray(rtf.formatToParts(100, 'day')));
+rtf.formatToParts(100, 'day').forEach(function(part) {
+ assertEquals(true, part.type == 'literal' || part.type == 'integer');
+ assertEquals('string', typeof part.value);
+ if (part.type == 'integer') {
+ assertEquals('string', typeof part.unit);
+ }
+});
diff --git a/deps/v8/test/intl/relative-time-format/format.js b/deps/v8/test/intl/relative-time-format/format.js
new file mode 100644
index 0000000000..769358423d
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format.js
@@ -0,0 +1,82 @@
+// Copyright 2018 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-relative-time-format
+
+// Make sure that RelativeTimeFormat exposes all required properties. Those not specified
+// should have undefined value.
+// http://tc39.github.io/proposal-intl-relative-time/
+
+let rtf = new Intl.RelativeTimeFormat();
+
+// Test 1.4.3 Intl.RelativeTimeFormat.prototype.format( value, unit )
+assertEquals('string', typeof rtf.format(-1, 'seconds'));
+assertEquals('string', typeof rtf.format(-1, 'second'));
+assertEquals('string', typeof rtf.format(-1, 'minutes'));
+assertEquals('string', typeof rtf.format(-1, 'minute'));
+assertEquals('string', typeof rtf.format(-1, 'hours'));
+assertEquals('string', typeof rtf.format(-1, 'hour'));
+assertEquals('string', typeof rtf.format(-1, 'days'));
+assertEquals('string', typeof rtf.format(-1, 'day'));
+assertEquals('string', typeof rtf.format(-1, 'weeks'));
+assertEquals('string', typeof rtf.format(-1, 'week'));
+assertEquals('string', typeof rtf.format(-1, 'months'));
+assertEquals('string', typeof rtf.format(-1, 'month'));
+assertEquals('string', typeof rtf.format(-1, 'years'));
+assertEquals('string', typeof rtf.format(-1, 'year'));
+assertEquals('string', typeof rtf.format(-1, 'quarter'));
+assertEquals('string', typeof rtf.format(-1, 'quarters'));
+
+assertEquals('string', typeof rtf.format(-0, 'seconds'));
+assertEquals('string', typeof rtf.format(-0, 'second'));
+assertEquals('string', typeof rtf.format(-0, 'minutes'));
+assertEquals('string', typeof rtf.format(-0, 'minute'));
+assertEquals('string', typeof rtf.format(-0, 'hours'));
+assertEquals('string', typeof rtf.format(-0, 'hour'));
+assertEquals('string', typeof rtf.format(-0, 'days'));
+assertEquals('string', typeof rtf.format(-0, 'day'));
+assertEquals('string', typeof rtf.format(-0, 'weeks'));
+assertEquals('string', typeof rtf.format(-0, 'week'));
+assertEquals('string', typeof rtf.format(-0, 'months'));
+assertEquals('string', typeof rtf.format(-0, 'month'));
+assertEquals('string', typeof rtf.format(-0, 'years'));
+assertEquals('string', typeof rtf.format(-0, 'year'));
+assertEquals('string', typeof rtf.format(-0, 'quarter'));
+assertEquals('string', typeof rtf.format(-0, 'quarters'));
+
+assertThrows(() => rtf.format(NaN, 'seconds'), RangeError);
+assertThrows(() => rtf.format(NaN, 'second'), RangeError);
+assertThrows(() => rtf.format(NaN, 'minutes'), RangeError);
+assertThrows(() => rtf.format(NaN, 'minute'), RangeError);
+assertThrows(() => rtf.format(NaN, 'hours'), RangeError);
+assertThrows(() => rtf.format(NaN, 'hour'), RangeError);
+assertThrows(() => rtf.format(NaN, 'days'), RangeError);
+assertThrows(() => rtf.format(NaN, 'day'), RangeError);
+assertThrows(() => rtf.format(NaN, 'weeks'), RangeError);
+assertThrows(() => rtf.format(NaN, 'week'), RangeError);
+assertThrows(() => rtf.format(NaN, 'months'), RangeError);
+assertThrows(() => rtf.format(NaN, 'month'), RangeError);
+assertThrows(() => rtf.format(NaN, 'years'), RangeError);
+assertThrows(() => rtf.format(NaN, 'year'), RangeError);
+assertThrows(() => rtf.format(NaN, 'quarters'), RangeError);
+assertThrows(() => rtf.format(NaN, 'quarter'), RangeError);
+
+assertThrows(() => rtf.format(-1, 'decades'), RangeError);
+assertThrows(() => rtf.format(-1, 'decade'), RangeError);
+assertThrows(() => rtf.format(-1, 'centuries'), RangeError);
+assertThrows(() => rtf.format(-1, 'century'), RangeError);
+assertThrows(() => rtf.format(-1, 'milliseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'millisecond'), RangeError);
+assertThrows(() => rtf.format(-1, 'microseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'microsecond'), RangeError);
+assertThrows(() => rtf.format(-1, 'nanoseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'nanosecond'), RangeError);
+
+assertEquals('string', typeof rtf.format(5, 'day'));
+assertEquals('string', typeof rtf.format('5', 'day'));
+assertEquals('string', typeof rtf.format('-5', 'day'));
+assertEquals('string', typeof rtf.format('534', 'day'));
+assertEquals('string', typeof rtf.format('-534', 'day'));
+
+//assertThrows(() => rtf.format('xyz', 'day'), RangeError);