Bug 1339817 - Part 2: Enable Intl.PluralRules tests from test262. r=shu
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 17 Feb 2017 08:26:49 -0800
changeset 372830 f6603d52cd90e9b7b883067fba9278cbdb2ebdbf
parent 372829 fa58978bd709a0ce3b866d424b6286570ec7b91f
child 372831 4a930acd18f8de343fc8ae6eafcd0b12798ea69c
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1339817
milestone54.0a1
Bug 1339817 - Part 2: Enable Intl.PluralRules tests from test262. r=shu
js/src/tests/jstests.list
js/src/tests/test262-intl-extras.js
js/src/tests/test262-update.py
js/src/tests/test262/intl402/PluralRules/builtin.js
js/src/tests/test262/intl402/PluralRules/can-be-subclassed.js
js/src/tests/test262/intl402/PluralRules/internals.js
js/src/tests/test262/intl402/PluralRules/length.js
js/src/tests/test262/intl402/PluralRules/name.js
js/src/tests/test262/intl402/PluralRules/prototype/bind.js
js/src/tests/test262/intl402/PluralRules/prototype/builtins.js
js/src/tests/test262/intl402/PluralRules/prototype/constructor/main.js
js/src/tests/test262/intl402/PluralRules/prototype/properties.js
js/src/tests/test262/intl402/PluralRules/prototype/prototype.js
js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/builtins.js
js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/name.js
js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/properties.js
js/src/tests/test262/intl402/PluralRules/prototype/select/name.js
js/src/tests/test262/intl402/PluralRules/shell.js
js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js
js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js
js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js
js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js
js/src/tests/test262/intl402/PluralRules/this-not-ignored.js
--- a/js/src/tests/jstests.list
+++ b/js/src/tests/jstests.list
@@ -432,16 +432,17 @@ skip script test262/language/expressions
 skip script test262/intl402/Collator/10.1.1_1.js
 skip script test262/intl402/NumberFormat/11.1.1_1.js
 skip script test262/intl402/DateTimeFormat/12.1.1_1.js
 
 # Waiting on https://github.com/tc39/ecma402/issues/122
 skip script test262/intl402/DateTimeFormat/prototype/12.3_a.js
 skip script test262/intl402/Collator/prototype/10.3_a.js
 skip script test262/intl402/NumberFormat/prototype/11.3_a.js
+skip script test262/intl402/PluralRules/prototype/prototype.js
 
 # https://bugzilla.mozilla.org/show_bug.cgi?id=1317378
 skip script test262/language/statements/do-while/cptn-abrupt-empty.js
 skip script test262/language/statements/do-while/cptn-normal.js
 skip script test262/language/statements/for-in/cptn-decl-abrupt-empty.js
 skip script test262/language/statements/for-in/cptn-decl-itr.js
 skip script test262/language/statements/for-in/cptn-decl-skip-itr.js
 skip script test262/language/statements/for-in/cptn-decl-zero-itr.js
@@ -543,37 +544,16 @@ skip script test262/language/expressions
 skip script test262/language/expressions/async-generators/expression-await-as-yield-operand.js
 skip script test262/language/expressions/async-generators/expression-yield-newline.js
 skip script test262/language/expressions/async-generators/expression-await-promise-as-yield-operand.js
 skip script test262/language/expressions/async-generators/expression-yield-star-before-newline.js
 
 # https://bugzilla.mozilla.org/show_bug.cgi?id=1050755
 skip script test262/built-ins/Date/UTC/return-value.js
 
-# PluralRules.
-skip script test262/intl402/PluralRules/builtin.js
-skip script test262/intl402/PluralRules/this-not-ignored.js
-skip script test262/intl402/PluralRules/name.js
-skip script test262/intl402/PluralRules/length.js
-skip script test262/intl402/PluralRules/supportedLocalesOf/main.js
-skip script test262/intl402/PluralRules/can-be-subclassed.js
-skip script test262/intl402/PluralRules/internals.js
-skip script test262/intl402/PluralRules/prototype/properties.js
-skip script test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js
-skip script test262/intl402/PluralRules/supportedLocalesOf/name.js
-skip script test262/intl402/PluralRules/supportedLocalesOf/arguments.js
-skip script test262/intl402/PluralRules/prototype/builtins.js
-skip script test262/intl402/PluralRules/prototype/prototype.js
-skip script test262/intl402/PluralRules/prototype/bind.js
-skip script test262/intl402/PluralRules/prototype/resolvedOptions/name.js
-skip script test262/intl402/PluralRules/prototype/resolvedOptions/properties.js
-skip script test262/intl402/PluralRules/prototype/resolvedOptions/builtins.js
-skip script test262/intl402/PluralRules/prototype/constructor/main.js
-skip script test262/intl402/PluralRules/prototype/select/name.js
-
 # SIMD.
 skip script test262/built-ins/Simd/check.js
 skip script test262/built-ins/Simd/from.js
 skip script test262/built-ins/Simd/operators.js
 skip script test262/built-ins/Simd/replace_lane.js
 skip script test262/built-ins/Simd/shuffle.js
 skip script test262/built-ins/Simd/swizzle.js
 
new file mode 100644
--- /dev/null
+++ b/js/src/tests/test262-intl-extras.js
@@ -0,0 +1,7 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+// Call the shell helper to add experimental features to the Intl object.
+if (typeof addIntlExtras === "function")
+    addIntlExtras(Intl);
--- a/js/src/tests/test262-update.py
+++ b/js/src/tests/test262-update.py
@@ -231,16 +231,20 @@ def convertTestFile(test262parser, testS
     if "includes" in testRec:
         assert not raw, "Raw test with includes: %s" % testName
         includeSet.update(testRec["includes"])
 
     # Skip intl402 tests when Intl isn't available.
     if pathStartsWith(testName, "intl402"):
         refTestSkipIf.append(("!this.hasOwnProperty('Intl')", "needs Intl"))
 
+    # Skip Intl.PluralRules tests when the addIntlExtras helper isn't available.
+    if pathStartsWith(testName, "intl402", "PluralRules"):
+        refTestSkipIf.append(("!this.hasOwnProperty('addIntlExtras')", "needs addIntlExtras"))
+
     # Skip built-ins/Simd tests when SIMD isn't available.
     if pathStartsWith(testName, "built-ins", "Simd"):
         refTestSkipIf.append(("!this.hasOwnProperty('SIMD')", "needs SIMD"))
 
     # Add reportCompare() after all positive, synchronous tests.
     if not isNegative and not async:
         testEpilogue = """
 reportCompare(0, 0);
@@ -301,16 +305,19 @@ def process_test262(test262Dir, test262O
     explicitIncludes = {}
     explicitIncludes["intl402"] = ["testBuiltInObject.js"]
     explicitIncludes[os.path.join("built-ins", "DataView")] = ["byteConversionValues.js"]
     explicitIncludes[os.path.join("built-ins", "Promise")] = ["PromiseHelper.js"]
     explicitIncludes[os.path.join("built-ins", "TypedArray")] = ["byteConversionValues.js",
         "detachArrayBuffer.js", "nans.js"]
     explicitIncludes[os.path.join("built-ins", "TypedArrays")] = ["detachArrayBuffer.js"]
 
+    # Intl.PluralRules isn't yet enabled by default.
+    localIncludesMap[os.path.join("intl402", "PluralRules")] = ["test262-intl-extras.js"]
+
     # Process all test directories recursively.
     for (dirPath, dirNames, fileNames) in os.walk(testDir):
         relPath = os.path.relpath(dirPath, testDir)
         if relPath == ".":
             continue
         os.makedirs(os.path.join(test262OutDir, relPath))
 
         includeSet = set()
--- a/js/src/tests/test262/intl402/PluralRules/builtin.js
+++ b/js/src/tests/test262/intl402/PluralRules/builtin.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules
 description: >
     Tests that Intl.PluralRules meets the requirements for
     built-in objects defined by the introduction of chapter 17 of the
--- a/js/src/tests/test262/intl402/PluralRules/can-be-subclassed.js
+++ b/js/src/tests/test262/intl402/PluralRules/can-be-subclassed.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-intl-pluralrules-constructor
 description: Tests that Intl.PluralRules can be subclassed.
 author: Zibi Braniecki
 includes: [testIntl.js]
--- a/js/src/tests/test262/intl402/PluralRules/internals.js
+++ b/js/src/tests/test262/intl402/PluralRules/internals.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-intl-pluralrules-constructor
 description: >
     Tests that objects constructed by Intl.PluralRules have the specified
     internal properties.
--- a/js/src/tests/test262/intl402/PluralRules/length.js
+++ b/js/src/tests/test262/intl402/PluralRules/length.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules
 description: Intl.PluralRules.length.
 author: Zibi Braniecki
 includes: [propertyHelper.js]
--- a/js/src/tests/test262/intl402/PluralRules/name.js
+++ b/js/src/tests/test262/intl402/PluralRules/name.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules
 description: Intl.PluralRules.name is "PluralRules"
 author: Zibi Braniecki
 includes: [propertyHelper.js]
--- a/js/src/tests/test262/intl402/PluralRules/prototype/bind.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/bind.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-properties-of-intl-pluralrules-prototype-object
 description: >
     Tests that Intl.PluralRules.prototype functions throw a TypeError if
     called on a non-object value or an object that hasn't been
--- a/js/src/tests/test262/intl402/PluralRules/prototype/builtins.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/builtins.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-properties-of-intl-pluralrules-prototype-object
 description: >
     Tests that Intl.PluralRules.prototype meets the requirements for
     built-in objects defined by the introduction of chapter 17 of the
--- a/js/src/tests/test262/intl402/PluralRules/prototype/constructor/main.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/constructor/main.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.prototype.constructor
 description: >
     Tests that Intl.PluralRules.prototype is an object that has been
     initialized as an Intl.PluralRules.
--- a/js/src/tests/test262/intl402/PluralRules/prototype/properties.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/properties.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-properties-of-intl-pluralrules-prototype-object
 description: Tests that Intl.PluralRules.prototype has the required attributes.
 author: Zibi Braniecki
 ---*/
--- a/js/src/tests/test262/intl402/PluralRules/prototype/prototype.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/prototype.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-properties-of-intl-pluralrules-prototype-object
 description: >
     Tests that Intl.PluralRules.prototype is an object that  has been
     initialized as an Intl.PluralRules.
--- a/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/builtins.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/builtins.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.prototype.resolvedOptions
 description: >
     Tests that Intl.PluralRules.prototype.resolvedOptions meets the requirements for
     built-in objects defined by the introduction of chapter 17 of the
--- a/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/name.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/name.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.resolvedOptions.name
 description: Intl.PluralRules.resolvedOptions.name is "resolvedOptions"
 author: Zibi Braniecki
 includes: [propertyHelper.js]
--- a/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/properties.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/resolvedOptions/properties.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.prototype.resolvedOptions
 description: >
     Tests that the object returned by
     Intl.PluralRules.prototype.resolvedOptions  has the right
--- a/js/src/tests/test262/intl402/PluralRules/prototype/select/name.js
+++ b/js/src/tests/test262/intl402/PluralRules/prototype/select/name.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.prototype.select
 description: Intl.PluralRules.prototype.select.name is "select"
 author: Zibi Braniecki
 includes: [propertyHelper.js]
--- a/js/src/tests/test262/intl402/PluralRules/shell.js
+++ b/js/src/tests/test262/intl402/PluralRules/shell.js
@@ -0,0 +1,8 @@
+// file: test262-intl-extras.js
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+// Call the shell helper to add experimental features to the Intl object.
+if (typeof addIntlExtras === "function")
+    addIntlExtras(Intl);
--- a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js
+++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/arguments.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.supportedLocalesOf
 description: >
     Tests that Intl.PluralRules.supportedLocalesOf doesn't access
     arguments that it's not given.
--- a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js
+++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/main.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.supportedLocalesOf
 description: >
     Tests that Intl.PluralRules has a supportedLocalesOf property, and
     it works as planned.
--- a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js
+++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/name.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.supportedLocalesOf
 description: Tests that Intl.PluralRules.supportedLocalesOf.name is "supportedLocalesOf"
 author: Zibi Braniecki
 includes: [propertyHelper.js]
--- a/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js
+++ b/js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules.supportedLocalesOf
 description: >
     Tests that Intl.PluralRules.supportedLocalesOf meets the requirements for
     built-in objects defined by the introduction of chapter 17 of the
--- a/js/src/tests/test262/intl402/PluralRules/this-not-ignored.js
+++ b/js/src/tests/test262/intl402/PluralRules/this-not-ignored.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!this.hasOwnProperty('Intl')) -- needs Intl
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras')) -- needs Intl, needs addIntlExtras
 // Copyright 2016 Mozilla Corporation. All rights reserved.
 // This code is governed by the license found in the LICENSE file.
 
 /*---
 esid: sec-Intl.PluralRules
 description: Tests that the this-value is ignored in PluralRules
 author: Zibi Braniecki
 includes: [testIntl.js]