From 00d280d23157b0b10e18ddf43791875baf72327e Mon Sep 17 00:00:00 2001
From: Frank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com>
Date: Thu, 24 Jan 2019 09:23:30 -0800
Subject: [PATCH] Remove test of extlang and 4 letter language (#2030)

This is due to the fact we now only accept Unicode Locale Identifier in
UTS 35.
---
 ...ructor-options-language-valid-undefined.js | 19 +++++++-----
 .../constructor-options-language-valid.js     | 30 ++++++++++++-------
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/test/intl402/Locale/constructor-options-language-valid-undefined.js b/test/intl402/Locale/constructor-options-language-valid-undefined.js
index 08b044abd2..388a66611b 100644
--- a/test/intl402/Locale/constructor-options-language-valid-undefined.js
+++ b/test/intl402/Locale/constructor-options-language-valid-undefined.js
@@ -13,10 +13,17 @@ info: |
     12. Set tag to ? ApplyOptionsToTag(tag, options).
 
     ApplyOptionsToTag( tag, options )
+
+    2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
     ...
-    9. If tag matches neither the privateuse nor the grandfathered production, then
-        b. If language is not undefined, then
-            i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
+
+    IsStructurallyValidLanguageTag ( locale )
+
+    The IsStructurallyValidLanguageTag abstract operation verifies that the
+    locale argument (which must be a String value)
+
+    represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+    Unicode Technical Standard 35 section 3.2, or successor,
 
 features: [Intl.Locale]
 ---*/
@@ -33,8 +40,4 @@ assert.sameValue(
   `new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"`
 );
 
-assert.sameValue(
-  new Intl.Locale('en-els', {language: undefined}).toString(),
-  'en-els',
-  `new Intl.Locale('en-els', {language: undefined}).toString() returns "en-els"`
-);
+assert.throws(RangeError, () => new Intl.Locale('en-els', {language: undefined}));
diff --git a/test/intl402/Locale/constructor-options-language-valid.js b/test/intl402/Locale/constructor-options-language-valid.js
index 6b7d405853..5f9723432c 100644
--- a/test/intl402/Locale/constructor-options-language-valid.js
+++ b/test/intl402/Locale/constructor-options-language-valid.js
@@ -14,9 +14,15 @@ info: |
 
     ApplyOptionsToTag( tag, options )
     ...
-    9. If tag matches neither the privateuse nor the grandfathered production, then
-        b. If language is not undefined, then
-            i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
+    2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+
+    IsStructurallyValidLanguageTag ( locale )
+
+    The IsStructurallyValidLanguageTag abstract operation verifies that the
+    locale argument (which must be a String value)
+
+    represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+    Unicode Technical Standard 35 section 3.2, or successor,
 
 features: [Intl.Locale]
 ---*/
@@ -25,7 +31,6 @@ const validLanguageOptions = [
   [null, 'null'],
   ['zh-cmn', 'cmn'],
   ['ZH-CMN', 'cmn'],
-  ['abcd', 'abcd'],
   [{ toString() { return 'de' } }, 'de'],
 ];
 for (const [language, expected] of validLanguageOptions) {
@@ -44,10 +49,15 @@ for (const [language, expected] of validLanguageOptions) {
     `new Intl.Locale('en-US', {language: "${language}"}).toString() returns "${expect}"`
   );
 
-  expect = expected || 'en-els';
-  assert.sameValue(
-    new Intl.Locale('en-els', {language}).toString(),
-    expect,
-    `new Intl.Locale('en-els', {language: "${language}"}).toString() returns "${expect}"`
-  );
+  assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
+
+}
+
+const invalidLanguageOptions = [
+    'abcd',
+];
+for (const language of invalidLanguageOptions) {
+  assert.throws(RangeError, () => new Intl.Locale('en', {language}));
+  assert.throws(RangeError, () => new Intl.Locale('en-US', {language}));
+  assert.throws(RangeError, () => new Intl.Locale('en-els', {language}));
 }
-- 
GitLab