Bläddra i källkod

Breaking apart and reclassifying tests.

Doug Ilijev 8 år sedan
förälder
incheckning
c545900794

+ 4 - 4
test/DebuggerCommon/rlexe.xml

@@ -33,7 +33,7 @@
       <compile-flags>-debuglaunch -dbgbaseline:IntlInit.js.dbg.baseline -Intl</compile-flags>
       <files>IntlInit.js</files>
       <!-- xplat-todo: enable on xplat when Intl is supported on xplat (Microsoft/ChakraCore#2919) -->
-      <tags>exclude_winglob,exclude_xplat,Intl</tags>
+      <tags>require_winglob,exclude_xplat,Intl</tags>
     </default>
   </test>
   <test>
@@ -41,7 +41,7 @@
       <files>ES6_intl_stepinto.js</files>
       <compile-flags>-dbgbaseline:ES6_intl_stepinto.js.dbg.baseline -Intl</compile-flags>
       <!-- xplat-todo: enable on xplat when Intl is supported on xplat (Microsoft/ChakraCore#2919) -->
-      <tags>exclude_winglob,exclude_xplat,Intl</tags>
+      <tags>require_winglob,exclude_xplat,Intl</tags>
     </default>
   </test>
   <test>
@@ -221,7 +221,7 @@
       <compile-flags>-dbgbaseline:ES6_intl_simple_attach.js.dbg.baseline -Intl</compile-flags>
       <baseline>ES6_intl_simple_attach.js.baseline</baseline>
       <!-- xplat-todo: enable on xplat when Intl is supported on xplat (Microsoft/ChakraCore#2919) -->
-      <tags>exclude_winglob,exclude_xplat,Intl</tags>
+      <tags>require_winglob,exclude_xplat,Intl</tags>
     </default>
   </test>
   <test>
@@ -294,7 +294,7 @@
       <files>ES6_intl_stepinto_libexpandos.js</files>
       <compile-flags>-debuglaunch -dbgbaseline:ES6_intl_stepinto_libexpandos.js.dbg.baseline -Intl</compile-flags>
       <!-- xplat-todo: enable on xplat when Intl is supported on xplat (Microsoft/ChakraCore#2919) -->
-      <tags>exclude_winglob,exclude_xplat,Intl</tags>
+      <tags>require_winglob,exclude_xplat,Intl</tags>
     </default>
   </test>
   <test>

+ 0 - 30
test/Intl/Collator.js

@@ -21,31 +21,6 @@ function testCollatorOptions(option, value, str1, str2, expected) {
     }
 }
 
-function arrayEqual(arr1, arr2) {
-    if (arr1.length !== arr2.length) return false;
-    for (var i = 0; i < arr1.length; i++) {
-        if (arr1[i] !== arr2[i]) return false;
-    }
-    return true;
-}
-
-function testSupportedLocales(locales, expectedResult) {
-    try {
-        var actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
-        if (!arrayEqual(actual, expectedResult)) {
-            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using best fit. Actual:[" + actual.join(",") + "]");
-        }
-        actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
-        if (!arrayEqual(actual, expectedResult)) {
-            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using lookup. Actual: [" + actual.join(",") + "]");
-        }
-    }
-    catch (ex) {
-        passed = false;
-        WScript.Echo("Error testSupportedLocales: " + ex.message);
-    }
-}
-
 testCollatorOptions("sensitivity", "base", "A", "a", 0);
 testCollatorOptions("sensitivity", "base", "A", "B", -1);
 testCollatorOptions("sensitivity", "base", "a", "\u00E2", 0);
@@ -65,11 +40,6 @@ testCollatorOptions("ignorePunctuation", false, ".a", "a", -1);
 testCollatorOptions("numeric", true, "10", "9", 1);
 testCollatorOptions("numeric", false, "10", "9", -1);
 
-testSupportedLocales(undefined, []);
-testSupportedLocales(["en-US"], ["en-US"]);
-testSupportedLocales([], []);
-testSupportedLocales(["xxx"], []);
-
 if (new Intl.Collator("es", { collation: "trad" }).resolvedOptions().collation !== "default") {
     WScript.Echo("Error: Collation option passed through option affects the value.");
     passed = false;

+ 39 - 0
test/Intl/CollatorSupportedLocales.js

@@ -0,0 +1,39 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+var passed = true;
+
+function arrayEqual(arr1, arr2) {
+    if (arr1.length !== arr2.length) return false;
+    for (var i = 0; i < arr1.length; i++) {
+        if (arr1[i] !== arr2[i]) return false;
+    }
+    return true;
+}
+
+function testSupportedLocales(locales, expectedResult) {
+    try {
+        var actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
+        if (!arrayEqual(actual, expectedResult)) {
+            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using best fit. Actual:[" + actual.join(",") + "]");
+        }
+        actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
+        if (!arrayEqual(actual, expectedResult)) {
+            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using lookup. Actual: [" + actual.join(",") + "]");
+        }
+    }
+    catch (ex) {
+        passed = false;
+        WScript.Echo("Error testSupportedLocales: " + ex.message);
+    }
+}
+
+testSupportedLocales(undefined, []);
+testSupportedLocales(["en-US"], ["en-US"]);
+testSupportedLocales([], []);
+
+if (passed === true) {
+    WScript.Echo("Pass");
+}

+ 37 - 0
test/Intl/CollatorUnsupportedLocales.js

@@ -0,0 +1,37 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+var passed = true;
+
+function arrayEqual(arr1, arr2) {
+    if (arr1.length !== arr2.length) return false;
+    for (var i = 0; i < arr1.length; i++) {
+        if (arr1[i] !== arr2[i]) return false;
+    }
+    return true;
+}
+
+function testSupportedLocales(locales, expectedResult) {
+    try {
+        var actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
+        if (!arrayEqual(actual, expectedResult)) {
+            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using best fit. Actual:[" + actual.join(",") + "]");
+        }
+        actual = Intl.Collator.supportedLocalesOf(locales, { localeMatcher: "best fit" });
+        if (!arrayEqual(actual, expectedResult)) {
+            throw new Error("Calling SupportedLocalesOf on '[" + locales.join(",") + "]' doesn't match expected result '[" + expectedResult.join(",") + "]' when using lookup. Actual: [" + actual.join(",") + "]");
+        }
+    }
+    catch (ex) {
+        passed = false;
+        WScript.Echo("Error testSupportedLocales: " + ex.message);
+    }
+}
+
+testSupportedLocales(["xxx"], []);
+
+if (passed === true) {
+    WScript.Echo("Pass");
+}

+ 49 - 0
test/Intl/DateTimeFormatInvalidOptions.js

@@ -0,0 +1,49 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
+
+// NOTE: \u200e is the U+200E LEFT-TO-RIGHT MARK
+var tests = [
+    {
+        name: "Test Invalid Options",
+        body: function () {
+            function verifyDTFException(locale, option, invalidValue, validValues) {
+                if (validValues.indexOf(invalidValue) !== -1) {
+                    assert.fail("Test constructed incorrectly.");
+                }
+                try {
+                    // Since minute and second aren't supported alone; doing this to prevent that exception.
+                    var options = { hour: "numeric", minute: "numeric" };
+                    options[option] = invalidValue;
+                    new Intl.DateTimeFormat(locale, options);
+                    assert.fail("Exception was expected. Option: " + option + "; invalid value: " + invalidValue);
+                }
+                catch (e) {
+                    if (!(e instanceof RangeError)) {
+                        assert.fail("Incorrect exception was thrown.");
+                    }
+                    assert.isTrue(e.message.indexOf(validValues) !== -1,
+                        "Checking exception message for correct values string. Looking for: " + validValues +
+                        "\nMessage: " + e.message);
+                }
+            }
+
+            verifyDTFException("en-US", "year", "long", "['2-digit', 'numeric']");
+            verifyDTFException("en-US", "month", "false", "['2-digit', 'numeric', 'narrow', 'short', 'long']");
+            verifyDTFException("en-US", "day", "long", "['2-digit', 'numeric']");
+            verifyDTFException("en-US", "hour", "long", "['2-digit', 'numeric']");
+            verifyDTFException("en-US", "minute", "long", "['2-digit', 'numeric']");
+            verifyDTFException("en-US", "second", "long", "['2-digit', 'numeric']");
+            verifyDTFException("en-US", "era", "numeric", "['narrow', 'short', 'long']");
+            verifyDTFException("en-US", "localeMatcher", "long", "['lookup', 'best fit']");
+            verifyDTFException("en-US", "formatMatcher", "long", "['basic', 'best fit']");
+
+            assert.areEqual(new Intl.DateTimeFormat("en-US", { hour: "numeric", hour12: "asdasd" }).resolvedOptions().hour12, true, "Hour12 special invalid option treatment.");
+        }
+    }
+];
+
+testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });

+ 0 - 37
test/Intl/DateTimeFormatOptions.js

@@ -34,43 +34,6 @@ var tests = [
             assert.areEqual(new Intl.DateTimeFormat("en-US", { hour: "numeric", hour12: true }).format(new Date(2000, 1, 1, 1, 1, 1)), "\u200e1\u200e \u200eAM", "Formatting hour as numeric with hour12=true.");
             assert.areEqual(new Intl.DateTimeFormat("en-US", { hour: "numeric", hour12: false }).format(new Date(2000, 1, 1, 1, 1, 1)), "\u200e1\u200e:\u200e00", "Formatting hour as numeric with hour12=false.");
         }
-    },
-    {
-        name: "Test Invalid Options",
-        body: function () {
-            function verifyDTFException(locale, option, invalidValue, validValues) {
-                if (validValues.indexOf(invalidValue) !== -1) {
-                    assert.fail("Test constructed incorrectly.");
-                }
-                try {
-                    // Since minute and second aren't supported alone; doing this to prevent that exception.
-                    var options = { hour: "numeric", minute: "numeric" };
-                    options[option] = invalidValue;
-                    new Intl.DateTimeFormat(locale, options);
-                    assert.fail("Exception was expected. Option: " + option + "; invalid value: " + invalidValue);
-                }
-                catch (e) {
-                    if (!(e instanceof RangeError)) {
-                        assert.fail("Incorrect exception was thrown.");
-                    }
-                    assert.isTrue(e.message.indexOf(validValues) !== -1,
-                        "Checking exception message for correct values string. Looking for: " + validValues +
-                        "\nMessage: " + e.message);
-                }
-            }
-
-            verifyDTFException("en-US", "year", "long", "['2-digit', 'numeric']");
-            verifyDTFException("en-US", "month", "false", "['2-digit', 'numeric', 'narrow', 'short', 'long']");
-            verifyDTFException("en-US", "day", "long", "['2-digit', 'numeric']");
-            verifyDTFException("en-US", "hour", "long", "['2-digit', 'numeric']");
-            verifyDTFException("en-US", "minute", "long", "['2-digit', 'numeric']");
-            verifyDTFException("en-US", "second", "long", "['2-digit', 'numeric']");
-            verifyDTFException("en-US", "era", "numeric", "['narrow', 'short', 'long']");
-            verifyDTFException("en-US", "localeMatcher", "long", "['lookup', 'best fit']");
-            verifyDTFException("en-US", "formatMatcher", "long", "['basic', 'best fit']");
-
-            assert.areEqual(new Intl.DateTimeFormat("en-US", { hour: "numeric", hour12: "asdasd" }).resolvedOptions().hour12, true, "Hour12 special invalid option treatment.");
-        }
     }
 ];
 

+ 35 - 14
test/Intl/rlexe.xml

@@ -3,7 +3,7 @@
   <test>
     <default>
       <files>Basics.js</files>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl</tags>
       <compile-flags>-args summary -endargs</compile-flags>
     </default>
   </test>
@@ -11,28 +11,49 @@
   <test>
     <default>
       <files>Collator.js</files>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl</tags>
     </default>
   </test>
   <test>
     <default>
       <files>CollatorOptions.js</files>
       <compile-flags>-args summary -endargs</compile-flags>
+      <tags>Intl,require_winglob</tags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>CollatorSupportedLocales.js</files>
+      <compile-flags>-args summary -endargs</compile-flags>
       <tags>Intl</tags>
     </default>
   </test>
   <test>
     <default>
-      <files>DateTimeFormatOptions.js</files>
+      <files>CollatorUnsupportedLocales.js</files>
+      <compile-flags>-args summary -endargs</compile-flags>
+      <tags>Intl,require_winglob</tags>
+    </default>
+  </test>
+  <test>
+    <default>
+      <files>DateTimeFormatInvalidOptions.js</files>
       <compile-flags>-args summary -endargs</compile-flags>
       <tags>Intl</tags>
     </default>
   </test>
+  <test>
+    <default>
+      <files>DateTimeFormatOptions.js</files>
+      <compile-flags>-args summary -endargs</compile-flags>
+      <tags>Intl,require_winglob</tags>
+    </default>
+  </test>
   <test>
     <default>
       <files>NumberFormat.js</files>
       <baseline>NumberFormat.baseline</baseline>
-      <tags>Intl,exclude_winglob,exclude_drt</tags>
+      <tags>Intl,require_winglob,exclude_drt</tags>
     </default>
   </test>
   <test>
@@ -47,55 +68,55 @@
     <default>
       <files>GetCanonicalLocales.js</files>
       <compile-flags>-args summary -endargs</compile-flags>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <files>SupportedLocalesOf.js</files>
       <compile-flags>-args summary -endargs</compile-flags>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <files>IntlHiddenInternals.js</files>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <files>IntlTaintingTests.js</files>
       <baseline>IntlTaintingTests.baseline</baseline>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <files>IntlTaintingPreInitTests.js</files>
       <baseline>IntlTaintingPreInitTests.baseline</baseline>
-      <tags>Intl,exclude_winglob,exclude_drt</tags>
+      <tags>Intl,require_winglob,exclude_drt</tags>
     </default>
   </test>
 
   <test>
     <default>
       <files>IntlBuiltIns.js</files>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <files>IntlIdentities.js</files>
       <compile-flags>-args summary -endargs</compile-flags>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
     <default>
       <compile-flags> -Intl -debugLaunch -dbgbaseline:IntlReturnedValueTests.js.dbg.baseline</compile-flags>
       <files>IntlReturnedValueTests.js</files>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
 
@@ -105,7 +126,7 @@
       <files>IntlInternalsHiddenFromExceptionStackTest.js</files>
       <baseline>IntlInternalsHiddenFromExceptionStackTest.baseline</baseline>
       <compile-flags>-ExtendedErrorStackForTestHost-</compile-flags>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
   <test>
@@ -114,7 +135,7 @@
       <files>IntlInternalsHiddenFromFirstChanceExceptionStackTest.js</files>
       <baseline>IntlInternalsHiddenFromFirstChanceExceptionStackTest.baseline</baseline>
       <compile-flags>-ExtendedErrorStackForTestHost-</compile-flags>
-      <tags>Intl,exclude_winglob</tags>
+      <tags>Intl,require_winglob</tags>
     </default>
   </test>
 

+ 1 - 1
test/utf8/rlexe.xml

@@ -16,7 +16,7 @@
   <test>
     <default>
       <files>OS_2977448.js</files>
-      <tags>exclude_winglob,BugFix</tags>
+      <tags>require_winglob,BugFix</tags>
     </default>
   </test>
   <test>