summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DisplayNames/prototype
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/DisplayNames/prototype')
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/Symbol.toStringTag.js23
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/browser.js0
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/browser.js0
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/shell.js0
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-invalid.js63
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-valid.js29
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-invalid.js39
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-valid.js24
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-invalid.js90
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-valid.js76
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/of/type-region-invalid.js85
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/prop-desc.js22
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/browser.js0
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/default-option-values.js82
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/length.js33
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/name.js29
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-fallback.js87
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-languagedisplay.js70
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-style.js89
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-type.js86
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/prop-desc.js30
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/return-object.js100
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/shell.js0
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-not-object-throws.js49
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-object-lacks-internal-throws.js43
-rw-r--r--js/src/tests/test262/intl402/DisplayNames/prototype/shell.js0
26 files changed, 1149 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/Symbol.toStringTag.js b/js/src/tests/test262/intl402/DisplayNames/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..de8db1a805
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/Symbol.toStringTag.js
@@ -0,0 +1,23 @@
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.DisplayNames.prototype-@@tostringtag
+description: >
+ Property descriptor of DisplayNames.prototype[@@toStringTag]
+info: |
+ The initial value of the @@toStringTag property is the string value "Intl.DisplayNames".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.DisplayNames, Symbol.toStringTag]
+---*/
+
+verifyProperty(Intl.DisplayNames.prototype, Symbol.toStringTag, {
+ value: "Intl.DisplayNames",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/browser.js b/js/src/tests/test262/intl402/DisplayNames/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/browser.js
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/browser.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/browser.js
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/shell.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/shell.js
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-invalid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-invalid.js
new file mode 100644
index 0000000000..1d7fc9ff43
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-invalid.js
@@ -0,0 +1,63 @@
+// Copyright 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Throws a RangeError for invalid `calendar` codes
+features: [Intl.DisplayNames-v2]
+---*/
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'calendar'});
+
+assert.throws(RangeError, function() {
+ displayNames.of('00');
+}, 'insufficient length');
+
+assert.throws(RangeError, function() {
+ displayNames.of('000000000');
+}, 'excessive length');
+
+assert.throws(RangeError, function() {
+ displayNames.of('-00000000');
+}, 'leading separator (dash)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('_00000000');
+}, 'leading separator (underscore)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('00000000-');
+}, 'trailing separator (dash)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('00000000_');
+}, 'trailing separator (underscore)');
+
+assert.throws(RangeError, function() {
+ displayNames.of(' abcdef');
+}, 'leading space');
+
+assert.throws(RangeError, function() {
+ displayNames.of('abcdef ');
+}, 'trailing space');
+
+assert.throws(RangeError, function() {
+ displayNames.of('abc def');
+}, 'interstitial space');
+
+assert.throws(RangeError, function() {
+ displayNames.of('123_abc');
+}, '2 segments, minimum length, underscore');
+
+assert.throws(RangeError, function() {
+ displayNames.of('12345678_abcdefgh');
+}, '2 segments, maximum length, underscore');
+
+assert.throws(RangeError, function() {
+ displayNames.of('123_abc_ABC');
+}, '3 segments, minimum length, underscore');
+
+assert.throws(RangeError, function() {
+ displayNames.of('12345678_abcdefgh_ABCDEFGH');
+}, '3 segments, maximum length, underscore');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-valid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-valid.js
new file mode 100644
index 0000000000..9f6bb2a8d1
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-calendar-valid.js
@@ -0,0 +1,29 @@
+// Copyright 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Returns string value for valid `calendar` codes
+features: [Intl.DisplayNames-v2]
+---*/
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'calendar'});
+
+assert.sameValue(typeof displayNames.of('01234567'), 'string', '[0-7]');
+assert.sameValue(typeof displayNames.of('899'), 'string', '[89]');
+
+assert.sameValue(typeof displayNames.of('abcdefgh'), 'string', '[a-h]');
+assert.sameValue(typeof displayNames.of('ijklmnop'), 'string', '[i-p]');
+assert.sameValue(typeof displayNames.of('qrstuvwx'), 'string', '[q-x]');
+assert.sameValue(typeof displayNames.of('yzz'), 'string', '[yz]');
+
+assert.sameValue(typeof displayNames.of('ABCDEFGH'), 'string', '[A-H]');
+assert.sameValue(typeof displayNames.of('IJKLMNOP'), 'string', '[I-P]');
+assert.sameValue(typeof displayNames.of('QRSTUVWX'), 'string', '[Q-X]');
+assert.sameValue(typeof displayNames.of('YZZ'), 'string', '[YZ]');
+
+assert.sameValue(typeof displayNames.of('123-abc'), 'string', '2 segments, minimum length, dash');
+assert.sameValue(typeof displayNames.of('12345678-abcdefgh'), 'string', '2 segments, maximum length, dash');
+assert.sameValue(typeof displayNames.of('123-abc-ABC'), 'string', '3 segments, minimum length, dash');
+assert.sameValue(typeof displayNames.of('12345678-abcdefgh-ABCDEFGH'), 'string', '3 segments, maximum length, dash');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-invalid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-invalid.js
new file mode 100644
index 0000000000..b1532a389c
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-invalid.js
@@ -0,0 +1,39 @@
+// Copyright 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Throws a RangeError for invalid `dateTimeField` codes
+features: [Intl.DisplayNames-v2]
+---*/
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'dateTimeField'});
+
+assert.throws(RangeError, function() {
+ displayNames.of('');
+}, 'empty string');
+
+assert.throws(RangeError, function() {
+ displayNames.of('timezoneName');
+}, 'timezoneName');
+
+assert.throws(RangeError, function() {
+ displayNames.of('timezonename');
+}, 'timezonename');
+
+assert.throws(RangeError, function() {
+ displayNames.of('millisecond');
+}, 'millisecond');
+
+assert.throws(RangeError, function() {
+ displayNames.of('seconds');
+}, 'seconds');
+
+assert.throws(RangeError, function() {
+ displayNames.of(' year');
+}, 'year (with leading space)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('year ');
+}, 'year (with trailing space)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-valid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-valid.js
new file mode 100644
index 0000000000..d649742ed5
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-datetimefield-valid.js
@@ -0,0 +1,24 @@
+// Copyright 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Returns string value for valid `dateTimeField` codes
+features: [Intl.DisplayNames-v2]
+---*/
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'dateTimeField'});
+
+assert.sameValue(typeof displayNames.of('era'), 'string', 'era');
+assert.sameValue(typeof displayNames.of('year'), 'string', 'year');
+assert.sameValue(typeof displayNames.of('quarter'), 'string', 'quarter');
+assert.sameValue(typeof displayNames.of('month'), 'string', 'month');
+assert.sameValue(typeof displayNames.of('weekOfYear'), 'string', 'weekOfYear');
+assert.sameValue(typeof displayNames.of('weekday'), 'string', 'weekday');
+assert.sameValue(typeof displayNames.of('day'), 'string', 'day');
+assert.sameValue(typeof displayNames.of('dayPeriod'), 'string', 'dayPeriod');
+assert.sameValue(typeof displayNames.of('hour'), 'string', 'hour');
+assert.sameValue(typeof displayNames.of('minute'), 'string', 'minute');
+assert.sameValue(typeof displayNames.of('second'), 'string', 'second');
+assert.sameValue(typeof displayNames.of('timeZoneName'), 'string', 'timeZoneName');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-invalid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-invalid.js
new file mode 100644
index 0000000000..e00ed3f1f5
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-invalid.js
@@ -0,0 +1,90 @@
+// Copyright (C) 2023 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Throws a RangeError for invalid `language` codes
+info: |
+ 12.3.3 Intl.DisplayNames.prototype.of ( code )
+
+ 1. If type is "language", then
+ a. If code cannot be matched by the unicode_language_id Unicode locale nonterminal, throw a RangeError exception.
+ b. If IsStructurallyValidLanguageTag(code) is false, throw a RangeError exception.
+ c. Return CanonicalizeUnicodeLocaleId(code).
+features: [Intl.DisplayNames-v2]
+---*/
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'language'});
+
+assert.throws(RangeError, function() {
+ displayNames.of('');
+}, 'invalid language subtag - empty string');
+
+assert.throws(RangeError, function() {
+ displayNames.of('a');
+}, 'invalid language subtag - only one character');
+
+assert.throws(RangeError, function() {
+ displayNames.of('abcdefghi');
+}, 'invalid language subtag - greater than 8 characters');
+
+assert.throws(RangeError, function() {
+ displayNames.of('en-u-hebrew');
+}, 'singleton subtag');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa-aaaa-bbbb');
+}, 'multiple script subtags');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa-aaaaa-aaaaa');
+}, 'duplicate variant subtag');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa-bb-cc');
+}, 'multiple region subtags');
+
+assert.throws(RangeError, function() {
+ displayNames.of('1a');
+}, 'invalid language subtag - leading digit');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa-1a');
+}, 'leading-digit subtag of length 2');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa-1aa');
+}, 'leading-digit non-numeric subtag of length 3');
+
+assert.throws(RangeError, function() {
+ displayNames.of('@#$%@#$');
+}, 'invalid characters');
+
+assert.throws(RangeError, function() {
+ displayNames.of('en-US-');
+}, 'separator not followed by subtag');
+
+assert.throws(RangeError, function() {
+ displayNames.of('-en');
+}, 'separator at start');
+
+assert.throws(RangeError, function() {
+ displayNames.of('en--GB');
+}, 'missing subtag between separators');
+
+assert.throws(RangeError, function() {
+ displayNames.of('root');
+}, 'BCP 47-incompatible CLDR syntax ("root" instead of "und")');
+
+assert.throws(RangeError, function(){
+ displayNames.of('abcd-GB');
+}, 'BCP 47-incompatible CLDR syntax (script subtag without a language subtag)');
+
+assert.throws(RangeError, function(){
+ displayNames.of('abcd');
+}, 'BCP 47-incompatible CLDR syntax (bare script subtag)');
+
+assert.throws(RangeError, function(){
+ displayNames.of('en_GB');
+}, 'BCP 47-incompatible CLDR syntax (_ as separator)');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-valid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-valid.js
new file mode 100644
index 0000000000..2b7932bf90
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-language-valid.js
@@ -0,0 +1,76 @@
+// Copyright (C) 2023 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Returns string value for valid `language` codes
+features: [Intl.DisplayNames]
+---*/
+
+
+/*
+unicode_language_id = "root" // not allowed in ES
+ | (unicode_language_subtag
+ (sep unicode_script_subtag)?
+ | unicode_script_subtag)
+ (sep unicode_region_subtag)?
+ (sep unicode_variant_subtag)*
+ */
+
+// unicode_language_subtag = alpha{2,3} | alpha{5,8} ;
+
+var languages = [ { subtag: 'ab', description: '2 letter language_subtag' },
+ { subtag: 'cde', description: '3 letter language_subtag' },
+ { subtag: 'zzzzzzzz', description: '8 letter language_subtag'} ];
+
+// unicode_script_subtag = alpha{4} ;
+var scripts = [ {subtag: 'abcd', description: '4 letter script_subtag' },
+ {subtag: '', description: ''} ];
+
+// unicode_region_subtag = (alpha{2} | digit{3}) ;
+var regions = [ {subtag: 'ab', description: '2 letter region_subtag' },
+ {subtag: '123', description: '3 digit region_subtag'},
+ {subtag: '', description: ''} ];
+
+// unicode_variant_subtag = (alphanum{5, 8} | digit alphanum{3}
+
+var variants = [ {subtag: 'abcde', description: '5 letter variant_subtag'},
+ {subtag: 'fghijklm', description: '8 letter variant_subtag'},
+ {subtag: '12345', description: '5 digit variant_subtag'},
+ {subtag: '1nopq', description: '5 chararcter leading digit variant_subtag'},
+ {subtag: '12345678', description: '8 digit variant_subtag'},
+ {subtag: 'a2345678', description: '8 character trailing digit variant_subtag'},
+ {subtag: '1abc', description: 'leading digit 4 character variant_subtag' },
+ {subtag: '2345', description: '4 digit variant_subtag'},
+ {subtag: '6d7e', description: 'leading digit 4 character mixed alphanum variant_subtag'},
+ {subtag: '', description: ''} ];
+
+
+function notEmpty(subtag) {
+ return subtag !== '';
+}
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'language'});
+
+for (var l in languages) {
+ for (var s in scripts) {
+ for (var r in regions) {
+ for (var v in variants) {
+ var languageTag = [languages[l].subtag, scripts[s].subtag, regions[r].subtag, variants[v].subtag].filter(notEmpty).join('-');
+ var languageDescription = [languages[l].description, scripts[s].description, regions[r].description, variants[v].description].filter(notEmpty).join(', ');
+
+ assert.sameValue(typeof displayNames.of(languageTag), 'string', languageDescription + ": " + languageTag);
+ if (variants[v].subtag !== ''){
+ for (var vAdditional in variants){
+ if (variants[vAdditional].subtag !== '' && vAdditional !== v){
+ languageTag += '-' + variants[vAdditional].subtag;
+ languageDescription += ", " + variants[vAdditional].description;
+ assert.sameValue(typeof displayNames.of(languageTag), 'string', languageDescription + ": " + languageTag);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-region-invalid.js b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-region-invalid.js
new file mode 100644
index 0000000000..0fcce4ac7e
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/of/type-region-invalid.js
@@ -0,0 +1,85 @@
+// Copyright 2023 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.of
+description: Throws a RangeError for invalid `region` codes
+info: |
+ 12.5.1 CanonicalCodeForDisplayNames ( code )
+
+ ...
+ 2. If type is "region", then
+ a. If code cannot be matched by the unicode_region_subtag Unicode locale nonterminal, throw a RangeError exception.
+ b. Return the ASCII-uppercase of code.
+features: [Intl.DisplayNames]
+---*/
+
+// https://unicode.org/reports/tr35/#unicode_region_subtag
+// unicode_region_subtag = (alpha{2} | digit{3}) ;
+
+var displayNames = new Intl.DisplayNames(undefined, {type: 'region'});
+
+assert.throws(RangeError, function() {
+ displayNames.of('00');
+}, 'insufficient length, numeric');
+
+assert.throws(RangeError, function() {
+ displayNames.of('a');
+}, 'insufficient length, alpha');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aaa');
+}, 'excessive length, alpha');
+
+assert.throws(RangeError, function() {
+ displayNames.of('1111');
+}, 'excessive length, numeric');
+
+assert.throws(RangeError, function() {
+ displayNames.of('');
+}, 'empty string');
+
+assert.throws(RangeError, function() {
+ displayNames.of('a01');
+}, 'mixed alphanumeric (alpha first, length 3)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('a1');
+}, 'mixed alphanumeric (alpha first, length 2)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('1a');
+}, 'mixed alphanumeric (numeric first, length 2)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('1a1');
+}, 'mixed alphanumeric (numeric first, length 3)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('-111');
+}, 'leading separator (dash)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('_111');
+}, 'leading separator (underscore)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('111-');
+}, 'trailing separator (dash)');
+
+assert.throws(RangeError, function() {
+ displayNames.of('111-');
+}, 'trailing separator (underscore)');
+
+assert.throws(RangeError, function() {
+ displayNames.of(' aa');
+}, 'leading space');
+
+assert.throws(RangeError, function() {
+ displayNames.of('aa ');
+}, 'trailing space');
+
+assert.throws(RangeError, function() {
+ displayNames.of('a c');
+}, 'interstitial space');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/prop-desc.js b/js/src/tests/test262/intl402/DisplayNames/prototype/prop-desc.js
new file mode 100644
index 0000000000..1c35488ac3
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/prop-desc.js
@@ -0,0 +1,22 @@
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype
+description: >
+ Property descriptor of Intl.DisplayNames.prototype
+info: |
+ The value of Intl.DisplayNames.prototype is %DisplayNamesPrototype%.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [Intl.DisplayNames]
+---*/
+
+verifyProperty(Intl.DisplayNames, "prototype", {
+ writable: false,
+ enumerable: false,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/browser.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/browser.js
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/default-option-values.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/default-option-values.js
new file mode 100644
index 0000000000..96475e2ded
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/default-option-values.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Default values for each option
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+
+ Intl.DisplayNames ( locales , options )
+
+ ...
+ 7. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
+ ...
+ 9. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]], requestedLocales, opt,
+ %DisplayNames%.[[RelevantExtensionKeys]]).
+ 10. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
+ ...
+ 12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
+ 13. If type is undefined, throw a TypeError exception.
+ ...
+ 15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
+ ...
+ 17. Set displayNames.[[Locale]] to the value of r.[[Locale]].
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames]
+includes: [propertyHelper.js]
+---*/
+
+var dn = new Intl.DisplayNames('en-US', {type: 'language'});
+
+var options = dn.resolvedOptions();
+
+verifyProperty(options, 'style', {
+ value: 'long',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+verifyProperty(options, 'type', {
+ value: 'language',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+verifyProperty(options, 'fallback', {
+ value: 'code',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/length.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/length.js
new file mode 100644
index 0000000000..402df82db0
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Intl.DisplayNames.prototype.resolvedOptions.length is 0.
+info: |
+ ECMAScript Standard Built-in Objects:
+
+ Every built-in function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description. Optional parameters
+ (which are indicated with brackets: [ ]) or rest parameters (which
+ are shown using the form «...name») are not included in the default
+ argument count.
+
+ Unless otherwise specified, the length property of a built-in function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.DisplayNames]
+---*/
+
+verifyProperty(Intl.DisplayNames.prototype.resolvedOptions, "length", {
+ value: 0,
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/name.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/name.js
new file mode 100644
index 0000000000..91f54d44cc
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/name.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Intl.DisplayNames.prototype.resolvedOptions.name is "resolvedOptions".
+info: |
+ 17 ECMAScript Standard Built-in Objects:
+
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value is a
+ String.
+
+ Unless otherwise specified, the name property of a built-in Function object,
+ if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Intl.DisplayNames]
+---*/
+
+verifyProperty(Intl.DisplayNames.prototype.resolvedOptions, "name", {
+ value: "resolvedOptions",
+ writable: false,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-fallback.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-fallback.js
new file mode 100644
index 0000000000..2fe0d03843
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-fallback.js
@@ -0,0 +1,87 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Values for the fallback option
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+ [[LanguageDisplay]]: "languageDisplay"
+
+ Intl.DisplayNames ( locales , options )
+
+ ...
+ 10. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]], requestedLocales, opt,
+ %DisplayNames%.[[RelevantExtensionKeys]]).
+ 11. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
+ ...
+ 12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
+ 13. If type is undefined, throw a TypeError exception.
+ ...
+ 15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
+ ...
+ 17. Set displayNames.[[Locale]] to the value of r.[[Locale]].
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames]
+includes: [propertyHelper.js]
+---*/
+
+const fallbacks = ['code', 'none'];
+const types = ['language', 'region', 'script', 'currency'];
+
+types.forEach(type => {
+ fallbacks.forEach(fallback => {
+ const dn = new Intl.DisplayNames('en-US', { fallback, type });
+ const options = dn.resolvedOptions();
+
+ verifyProperty(options, 'fallback', {
+ value: fallback,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'type', {
+ value: type,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'style', {
+ value: 'long',
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-languagedisplay.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-languagedisplay.js
new file mode 100644
index 0000000000..3b3317a9d6
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-languagedisplay.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: Values for the languageDisplay option
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+ [[LanguageDisplay]]: "languageDisplay"
+
+ Intl.DisplayNames ( locales , options )
+
+ ...
+ 24. Let languageDisplay be ? GetOption(options, "languageDisplay", "string",
+ « "dialect", "standard" », "dialect").
+ 25. If type is "language", then
+ a. Set displayNames.[[LanguageDisplay]] to languageDisplay.
+ b. Let typeFields be typeFields.[[<languageDisplay>]].
+ c. Assert: typeFields is a Record (see 1.4.3).
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames-v2]
+includes: [propertyHelper.js]
+---*/
+
+var dn;
+
+dn = new Intl.DisplayNames('en-US', { type: 'language', languageDisplay: 'dialect' });
+
+verifyProperty(dn.resolvedOptions(), 'languageDisplay', {
+ value: 'dialect',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+dn = new Intl.DisplayNames('en-US', { type: 'language', languageDisplay: 'standard' });
+
+verifyProperty(dn.resolvedOptions(), 'languageDisplay', {
+ value: 'standard',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-style.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-style.js
new file mode 100644
index 0000000000..12961ca43e
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-style.js
@@ -0,0 +1,89 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Values for the style option
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+ [[LanguageDisplay]]: "languageDisplay"
+
+ Intl.DisplayNames ( locales , options )
+
+ ...
+ 8. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
+ ...
+ 10. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]], requestedLocales, opt,
+ %DisplayNames%.[[RelevantExtensionKeys]]).
+ 10. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
+ ...
+ 12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
+ 13. If type is undefined, throw a TypeError exception.
+ ...
+ 15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
+ ...
+ 17. Set displayNames.[[Locale]] to the value of r.[[Locale]].
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames]
+includes: [propertyHelper.js]
+---*/
+
+const styles = ['narrow', 'short', 'long'];
+const types = ['language', 'region', 'script', 'currency'];
+
+types.forEach(type => {
+ styles.forEach(style => {
+ const dn = new Intl.DisplayNames('en-US', { style, type });
+ const options = dn.resolvedOptions();
+
+ verifyProperty(options, 'style', {
+ value: style,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'type', {
+ value: type,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'fallback', {
+ value: 'code',
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-type.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-type.js
new file mode 100644
index 0000000000..5bb0254f0e
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/option-type.js
@@ -0,0 +1,86 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Values for the type option
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+ [[LanguageDisplay]]: "languageDisplay"
+
+ Intl.DisplayNames ([ locales [ , options ]])
+
+ ...
+ 8. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
+ ...
+ 10. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]], requestedLocales, opt,
+ %DisplayNames%.[[RelevantExtensionKeys]]).
+ 11. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
+ ...
+ 13. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency"»,
+ "language").
+ ...
+ 15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
+ ...
+ 17. Set displayNames.[[Locale]] to the value of r.[[Locale]].
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames]
+includes: [propertyHelper.js]
+---*/
+
+var types = ['language', 'region', 'script', 'currency'];
+
+types.forEach(type => {
+ var dn = new Intl.DisplayNames('en-US', { type });
+ var options = dn.resolvedOptions();
+
+ verifyProperty(options, 'type', {
+ value: type,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'fallback', {
+ value: 'code',
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+
+ verifyProperty(options, 'style', {
+ value: 'long',
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/prop-desc.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/prop-desc.js
new file mode 100644
index 0000000000..1766f5a5ce
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/prop-desc.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Property descriptor of Intl.DisplayNames.prototype.resolvedOptions
+info: |
+ 17 ECMAScript Standard Built-in Objects:
+
+ Every other data property described in clauses 18 through 26 and in Annex B.2
+ has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+features: [Intl.DisplayNames]
+---*/
+
+assert.sameValue(
+ typeof Intl.DisplayNames.prototype.resolvedOptions,
+ "function",
+ "`typeof Intl.DisplayNames.prototype.resolvedOptions` is `'function'`"
+);
+
+verifyProperty(Intl.DisplayNames.prototype, "resolvedOptions", {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/return-object.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/return-object.js
new file mode 100644
index 0000000000..9f5d2f8e3d
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/return-object.js
@@ -0,0 +1,100 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Returns a new ordinary object on each call, with data properties containing values from internals
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ 3. Let options be ! ObjectCreate(%ObjectPrototype%).
+ 4. For each row of Table 6, except the header row, in table order, do
+ a. Let p be the Property value of the current row.
+ b. Let v be the value of pr's internal slot whose name is the Internal Slot value of the current row.
+ c. If v is not undefined, then
+ i. Perform ! CreateDataPropertyOrThrow(options, p, v).
+ 6. Return options.
+
+ Table 6: Resolved Options of DisplayNames Instances
+
+ [[Locale]]: "locale"
+ [[Style]]: "style"
+ [[Type]]: "type"
+ [[Fallback]]: "fallback"
+ [[LanguageDisplay]]: "languageDisplay"
+
+ Intl.DisplayNames ( locales , options )
+
+ ...
+ 7. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
+ ...
+ 9. Let r be ResolveLocale(%DisplayNames%.[[AvailableLocales]], requestedLocales, opt,
+ %DisplayNames%.[[RelevantExtensionKeys]]).
+ 10. Let style be ? GetOption(options, "style", "string", « "narrow", "short", "long" », "long").
+ ...
+ 12. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency" », undefined).
+ 13. If type is undefined, throw a TypeError exception.
+ ...
+ 15. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code").
+ ...
+ 17. Set displayNames.[[Locale]] to the value of r.[[Locale]].
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ ...
+locale: [en-US]
+features: [Intl.DisplayNames-v2, Reflect]
+includes: [propertyHelper.js, compareArray.js]
+---*/
+
+const dn = new Intl.DisplayNames('en-US', {type: 'language'});
+
+const options = dn.resolvedOptions();
+const other = dn.resolvedOptions();
+
+assert.notSameValue(options, other, 'each call returns a new object');
+
+assert.sameValue(Object.getPrototypeOf(options), Object.prototype, 'ordinary object #1');
+assert.sameValue(Object.getPrototypeOf(other), Object.prototype, 'ordinary object #2');
+
+assert.compareArray(
+ Reflect.ownKeys(options),
+ ['locale', 'style', 'type', 'fallback', 'languageDisplay'],
+ 'all the data properties set to this object, in order of creation'
+);
+
+verifyProperty(options, 'locale', {
+ value: 'en-US',
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+
+const explicit = new Intl.DisplayNames(
+ 'en', { localeMatcher: 'lookup', type: 'language' }).resolvedOptions();
+
+assert.sameValue(
+ explicit.hasOwnProperty('localeMatcher'),
+ false,
+ 'the localeMatcher option is not set, option was explicitly set'
+);
+
+const extra = new Intl.DisplayNames(
+ 'en', { chaos: 'yes', random: 'sure', '0': 42, type: 'language' }).resolvedOptions();
+
+assert.compareArray(
+ Reflect.ownKeys(extra),
+ ['locale', 'style', 'type', 'fallback', 'languageDisplay'],
+ 'extra properties are not reflected in the resolvedOptions'
+);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/shell.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/shell.js
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-not-object-throws.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-not-object-throws.js
new file mode 100644
index 0000000000..42cac5976e
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-not-object-throws.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Throws a TypeError if this is not Object.
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ ...
+features: [Intl.DisplayNames, Symbol]
+---*/
+
+var resolvedOptions = Intl.DisplayNames.prototype.resolvedOptions;
+
+assert.throws(TypeError, function() {
+ resolvedOptions();
+}, 'direct call');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call('en');
+}, 'string');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(1);
+}, 'number');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(null);
+}, 'null');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(true);
+}, 'true');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(false);
+}, 'false');
+
+var symbol = Symbol();
+assert.throws(TypeError, function() {
+ resolvedOptions.call(symbol);
+}, 'symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-object-lacks-internal-throws.js b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-object-lacks-internal-throws.js
new file mode 100644
index 0000000000..9ad4c1517b
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/resolvedOptions/this-object-lacks-internal-throws.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DisplayNames.prototype.resolvedOptions
+description: >
+ Throws a TypeError if this does not have an [[InitializedDisplayNames]] internal slot.
+info: |
+ Intl.DisplayNames.prototype.resolvedOptions ()
+
+ 1. Let pr be the this value.
+ 2. If Type(pr) is not Object or pr does not have an [[InitializedDisplayNames]] internal slot,
+ throw a TypeError exception.
+ ...
+features: [Intl.DisplayNames]
+---*/
+
+var resolvedOptions = Intl.DisplayNames.prototype.resolvedOptions;
+
+assert.throws(TypeError, function() {
+ Intl.DisplayNames.prototype.resolvedOptions();
+}, 'Intl.DisplayNames.prototype does not have the internal slot');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call({});
+}, 'ordinary object');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(Intl.DisplayNames);
+}, 'Intl.DisplayNames does not have the internal slot');
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(Intl);
+}, 'Intl does not have the internal slot');
+
+// Not DisplayNames!!!
+var dtf = new Intl.DateTimeFormat();
+
+assert.throws(TypeError, function() {
+ resolvedOptions.call(dtf);
+}, 'resolvedOptions cannot be used with instances from different Intl ctors');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DisplayNames/prototype/shell.js b/js/src/tests/test262/intl402/DisplayNames/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/DisplayNames/prototype/shell.js