From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- js/src/tests/test262/intl402/ch13/13.3/13.3.0_1.js | 32 ++++++++++ js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.js | 26 ++++++++ .../tests/test262/intl402/ch13/13.3/13.3.0_6_1.js | 74 ++++++++++++++++++++++ .../tests/test262/intl402/ch13/13.3/13.3.0_6_2.js | 15 +++++ js/src/tests/test262/intl402/ch13/13.3/13.3.0_7.js | 58 +++++++++++++++++ .../tests/test262/intl402/ch13/13.3/13.3.1_L15.js | 14 ++++ .../tests/test262/intl402/ch13/13.3/13.3.2_L15.js | 14 ++++ .../tests/test262/intl402/ch13/13.3/13.3.3_L15.js | 14 ++++ js/src/tests/test262/intl402/ch13/13.3/browser.js | 0 js/src/tests/test262/intl402/ch13/13.3/shell.js | 0 10 files changed, 247 insertions(+) create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.0_1.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_1.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_2.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.0_7.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.1_L15.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.2_L15.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/13.3.3_L15.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/browser.js create mode 100644 js/src/tests/test262/intl402/ch13/13.3/shell.js (limited to 'js/src/tests/test262/intl402/ch13/13.3') diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.0_1.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_1.js new file mode 100644 index 000000000..0f2902162 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_1.js @@ -0,0 +1,32 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString & Co. handle "this time value" correctly. + * @author Norbert Lindenberg + */ + +var functions = { + toLocaleString: Date.prototype.toLocaleString, + toLocaleDateString: Date.prototype.toLocaleDateString, + toLocaleTimeString: Date.prototype.toLocaleTimeString +}; +var invalidValues = [undefined, null, 5, "5", false, {valueOf: function () { return 5; }}]; + +Object.getOwnPropertyNames(functions).forEach(function (p) { + var f = functions[p]; + invalidValues.forEach(function (value) { + var error; + try { + var result = f.call(value); + } catch (e) { + error = e; + } + if (error === undefined) { + $ERROR("Date.prototype." + p + " did not reject this = " + value + "."); + } else if (error.name !== "TypeError") { + $ERROR("Date.prototype." + p + " rejected this = " + value + " with wrong error " + error.name + "."); + } + }); +}); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.js new file mode 100644 index 000000000..7d5f32fa6 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.js @@ -0,0 +1,26 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString & Co. handle non-finite values correctly. + * @author Norbert Lindenberg + */ + +var functions = { + toLocaleString: Date.prototype.toLocaleString, + toLocaleDateString: Date.prototype.toLocaleDateString, + toLocaleTimeString: Date.prototype.toLocaleTimeString +}; +var invalidValues = [NaN, Infinity, -Infinity]; + +Object.getOwnPropertyNames(functions).forEach(function (p) { + var f = functions[p]; + invalidValues.forEach(function (value) { + var result = f.call(new Date(value)); + if (result !== "Invalid Date") { + $ERROR("Date.prototype." + p + " did not return \"Invalid Date\" for " + + value + " – got " + result + " instead."); + } + }); +}); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_1.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_1.js new file mode 100644 index 000000000..c97b240b4 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_1.js @@ -0,0 +1,74 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString & Co. throws the same exceptions as Intl.DateTimeFormat. + * @author Norbert Lindenberg + */ + +var functions = { + toLocaleString: Date.prototype.toLocaleString, + toLocaleDateString: Date.prototype.toLocaleDateString, + toLocaleTimeString: Date.prototype.toLocaleTimeString +}; +var locales = [null, [NaN], ["i"], ["de_DE"]]; +var options = [ + {localeMatcher: null}, + {timeZone: "invalid"}, + {hour: "long"}, + {formatMatcher: "invalid"} +]; + +Object.getOwnPropertyNames(functions).forEach(function (p) { + var f = functions[p]; + locales.forEach(function (locales) { + var referenceError, error; + try { + var format = new Intl.DateTimeFormat(locales); + } catch (e) { + referenceError = e; + } + if (referenceError === undefined) { + $ERROR("Internal error: Expected exception was not thrown by Intl.DateTimeFormat for locales " + locales + "."); + } + + try { + var result = f.call(new Date(), locales); + } catch (e) { + error = e; + } + if (error === undefined) { + $ERROR("Date.prototype." + p + " didn't throw exception for locales " + locales + "."); + } else if (error.name !== referenceError.name) { + $ERROR("Date.prototype." + p + " threw exception " + error.name + + " for locales " + locales + "; expected " + referenceError.name + "."); + } + }); + + options.forEach(function (options) { + var referenceError, error; + try { + var format = new Intl.DateTimeFormat([], options); + } catch (e) { + referenceError = e; + } + if (referenceError === undefined) { + $ERROR("Internal error: Expected exception was not thrown by Intl.DateTimeFormat for options " + + JSON.stringify(options) + "."); + } + + try { + var result = f.call(new Date(), [], options); + } catch (e) { + error = e; + } + if (error === undefined) { + $ERROR("Date.prototype." + p + " didn't throw exception for options " + + JSON.stringify(options) + "."); + } else if (error.name !== referenceError.name) { + $ERROR("Date.prototype." + p + " threw exception " + error.name + + " for options " + JSON.stringify(options) + "; expected " + referenceError.name + "."); + } + }); +}); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_2.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_2.js new file mode 100644 index 000000000..dcce05906 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_6_2.js @@ -0,0 +1,15 @@ +// Copyright 2013 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString & Co. use the standard + * built-in Intl.DateTimeFormat constructor. + * @author Norbert Lindenberg + */ + +$INCLUDE("testIntl.js"); + +taintDataProperty(Intl, "DateTimeFormat"); +new Date().toLocaleString(); +new Date().toLocaleDateString(); +new Date().toLocaleTimeString(); diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.0_7.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_7.js new file mode 100644 index 000000000..fe7c9271d --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.0_7.js @@ -0,0 +1,58 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString & Co. produces the same results as Intl.DateTimeFormat. + * @author Norbert Lindenberg + */ + +$INCLUDE("testIntl.js"); + +var functions = { + toLocaleString: [Date.prototype.toLocaleString, + {year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric"}], + toLocaleDateString: [Date.prototype.toLocaleDateString, + {year: "numeric", month: "numeric", day: "numeric"}], + toLocaleTimeString: [Date.prototype.toLocaleTimeString, + {hour: "numeric", minute: "numeric", second: "numeric"}] +}; +var dates = [new Date(), new Date(0), new Date(Date.parse("1989-11-09T17:57:00Z"))]; +var locales = [undefined, ["de"], ["th-u-ca-gregory-nu-thai"], ["en"], ["ja-u-ca-japanese"], ["ar-u-ca-islamicc-nu-arab"]]; +var options = [ + undefined, + {hour12: false}, + {month: "long", day: "numeric", hour: "2-digit", minute: "2-digit"} +]; + +Object.getOwnPropertyNames(functions).forEach(function (p) { + var f = functions[p][0]; + var defaults = functions[p][1]; + locales.forEach(function (locales) { + options.forEach(function (options) { + var constructorOptions = options; + if (options === undefined) { + constructorOptions = defaults; + } else if (options.day === undefined) { + // for simplicity, our options above have either both date and time or neither + constructorOptions = Object.create(defaults); + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + constructorOptions[prop] = options[prop]; + } + } + } + var referenceDateTimeFormat = new Intl.DateTimeFormat(locales, constructorOptions); + var referenceFormatted = dates.map(referenceDateTimeFormat.format); + + var formatted = dates.map(function (a) { return f.call(a, locales, options); }); + try { + testArraysAreSame(referenceFormatted, formatted); + } catch (e) { + e.message += " (Testing with locales " + locales + "; options " + + (options ? JSON.stringify(options) : options) + ".)"; + throw e; + } + }); + }); +}); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.1_L15.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.1_L15.js new file mode 100644 index 000000000..a8c697c07 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.1_L15.js @@ -0,0 +1,14 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleString + * meets the requirements for built-in objects defined by the introduction of + * chapter 15 of the ECMAScript Language Specification. + * @author Norbert Lindenberg + */ + +$INCLUDE("testBuiltInObject.js"); + +testBuiltInObject(Date.prototype.toLocaleString, true, false, [], 0); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.2_L15.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.2_L15.js new file mode 100644 index 000000000..5eeed944e --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.2_L15.js @@ -0,0 +1,14 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleDateString + * meets the requirements for built-in objects defined by the introduction of + * chapter 15 of the ECMAScript Language Specification. + * @author Norbert Lindenberg + */ + +$INCLUDE("testBuiltInObject.js"); + +testBuiltInObject(Date.prototype.toLocaleDateString, true, false, [], 0); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/13.3.3_L15.js b/js/src/tests/test262/intl402/ch13/13.3/13.3.3_L15.js new file mode 100644 index 000000000..dac7c3513 --- /dev/null +++ b/js/src/tests/test262/intl402/ch13/13.3/13.3.3_L15.js @@ -0,0 +1,14 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/** + * @description Tests that Date.prototype.toLocaleTimeString + * meets the requirements for built-in objects defined by the introduction of + * chapter 15 of the ECMAScript Language Specification. + * @author Norbert Lindenberg + */ + +$INCLUDE("testBuiltInObject.js"); + +testBuiltInObject(Date.prototype.toLocaleTimeString, true, false, [], 0); + diff --git a/js/src/tests/test262/intl402/ch13/13.3/browser.js b/js/src/tests/test262/intl402/ch13/13.3/browser.js new file mode 100644 index 000000000..e69de29bb diff --git a/js/src/tests/test262/intl402/ch13/13.3/shell.js b/js/src/tests/test262/intl402/ch13/13.3/shell.js new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3