diff options
Diffstat (limited to 'js/src/tests/test262/intl402/String')
27 files changed, 884 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/String/browser.js b/js/src/tests/test262/intl402/String/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/browser.js diff --git a/js/src/tests/test262/intl402/String/prototype/browser.js b/js/src/tests/test262/intl402/String/prototype/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/browser.js diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/browser.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/browser.js diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/builtin.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/builtin.js new file mode 100644 index 0000000000..ea9820bab9 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/builtin.js @@ -0,0 +1,30 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es5id: 13.1.1_L15 +description: > + Tests that String.prototype.localeCompare meets the requirements + for built-in objects defined by the introduction of chapter 17 of + the ECMAScript Language Specification. +author: Norbert Lindenberg +includes: [isConstructor.js] +features: [Reflect.construct] +---*/ + +assert.sameValue(Object.prototype.toString.call(String.prototype.localeCompare), "[object Function]", + "The [[Class]] internal property of a built-in function must be " + + "\"Function\"."); + +assert(Object.isExtensible(String.prototype.localeCompare), + "Built-in objects must be extensible."); + +assert.sameValue(Object.getPrototypeOf(String.prototype.localeCompare), Function.prototype); + +assert.sameValue(String.prototype.localeCompare.hasOwnProperty("prototype"), false, + "Built-in functions that aren't constructors must not have a prototype property."); + +assert.sameValue(isConstructor(String.prototype.localeCompare), false, + "Built-in functions don't implement [[Construct]] unless explicitly specified."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/default-options-object-prototype.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/default-options-object-prototype.js new file mode 100644 index 0000000000..dac753245b --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/default-options-object-prototype.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Daniel Ehrenberg. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializecollator +description: > + Monkey-patching Object.prototype does not change the default + options for Collator as a null prototype is used. +info: | + InitializeCollator ( collator, locales, options ) + + 1. If _options_ is *undefined*, then + 1. Let _options_ be ObjectCreate(*null*). +---*/ + +if (new Intl.Collator("en").resolvedOptions().locale === "en") { + Object.prototype.sensitivity = "base"; + assert.sameValue("a".localeCompare("A"), -1); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/length.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/length.js new file mode 100644 index 0000000000..8fb28c2328 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sup-String.prototype.localeCompare +description: > + String.prototype.localeCompare.length is 1. +info: | + String.prototype.localeCompare ( that [ , locales [ , options ] ] ) + + 17 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] +---*/ + +verifyProperty(String.prototype.localeCompare, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/missing-arguments-coerced-to-undefined.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/missing-arguments-coerced-to-undefined.js new file mode 100644 index 0000000000..2b80e84a89 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/missing-arguments-coerced-to-undefined.js @@ -0,0 +1,21 @@ +// Copyright 2013 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es5id: 13.1.1_3_2 +description: > + Tests that String.prototype.localeCompare treats a missing "that" + argument, undefined, and "undefined" as equivalent. +author: Norbert Lindenberg +---*/ + +var thisValues = ["a", "t", "u", "undefined", "UNDEFINED", "nicht definiert", "xyz", "未定义"]; + +var i; +for (i = 0; i < thisValues.length; i++) { + var thisValue = thisValues[i]; + assert.sameValue(thisValue.localeCompare(), thisValue.localeCompare(undefined), "String.prototype.localeCompare does not treat missing 'that' argument as undefined."); + assert.sameValue(thisValue.localeCompare(undefined), thisValue.localeCompare("undefined"), "String.prototype.localeCompare does not treat undefined 'that' argument as \"undefined\"."); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/return-abrupt-this-value.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/return-abrupt-this-value.js new file mode 100644 index 0000000000..21de34a98d --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/return-abrupt-this-value.js @@ -0,0 +1,20 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1.1_1 +description: > + Tests that localeCompare rejects values that can't be coerced to + an object. +author: Norbert Lindenberg +---*/ + +var invalidValues = [undefined, null]; + +invalidValues.forEach(function (value) { + assert.throws(TypeError, function() { + var result = String.prototype.localeCompare.call(value, ""); + }, "String.prototype.localeCompare did not reject this = " + value + "."); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/returns-same-results-as-Collator.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/returns-same-results-as-Collator.js new file mode 100644 index 0000000000..c93530777d --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/returns-same-results-as-Collator.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. + +/*--- +es5id: 13.1.1_7 +description: > + Tests that localeCompare produces the same results as + Intl.Collator. +author: Norbert Lindenberg +includes: [compareArray.js] +---*/ + +var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "𠮷野家", "吉野家", "!A", "A", "b", "C"]; +var locales = [undefined, ["de"], ["de-u-co-phonebk"], ["en"], ["ja"], ["sv"]]; +var options = [ + undefined, + {usage: "search"}, + {sensitivity: "base", ignorePunctuation: true} +]; + +locales.forEach(function (locales) { + options.forEach(function (options) { + var referenceCollator = new Intl.Collator(locales, options); + var referenceSorted = strings.slice().sort(referenceCollator.compare); + + strings.sort(function (a, b) { return a.localeCompare(b, locales, options); }); + assert.compareArray(strings, referenceSorted, + "(Testing with locales " + locales + "; options " + JSON.stringify(options) + ".)"); + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/shell.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/taint-Intl-Collator.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/taint-Intl-Collator.js new file mode 100644 index 0000000000..2955b6a8f0 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/taint-Intl-Collator.js @@ -0,0 +1,16 @@ +// Copyright 2013 Mozilla Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +es5id: 13.1.1_6_2 +description: > + Tests that String.prototype.localeCompare uses the standard + built-in Intl.Collator constructor. +author: Norbert Lindenberg +includes: [testIntl.js] +---*/ + +taintDataProperty(Intl, "Collator"); +"a".localeCompare("b"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/that-arg-coerced-to-string.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/that-arg-coerced-to-string.js new file mode 100644 index 0000000000..8de5a8129c --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/that-arg-coerced-to-string.js @@ -0,0 +1,22 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1.1_3_1 +description: Tests that localeCompare coerces that to a string. +author: Norbert Lindenberg +---*/ + +var thisValues = ["true", "5", "hello", "good bye"]; +var thatValues = [true, 5, "hello", {toString: function () { return "good bye"; }}]; + +var i; +for (i = 0; i < thisValues.length; i++) { + var j; + for (j = 0; j < thatValues.length; j++) { + var result = String.prototype.localeCompare.call(thisValues[i], thatValues[j]); + assert.sameValue((result === 0), (i === j), "localeCompare treats " + thisValues[i] + " and " + thatValues[j] + " as " + (result === 0 ? "equal" : "different") + "."); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/this-value-coerced-to-string.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/this-value-coerced-to-string.js new file mode 100644 index 0000000000..b8c999059e --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/this-value-coerced-to-string.js @@ -0,0 +1,22 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1.1_2 +description: Tests that localeCompare coerces this to a string. +author: Norbert Lindenberg +---*/ + +var thisValues = [true, 5, "hello", {toString: function () { return "good bye"; }}]; +var thatValues = ["true", "5", "hello", "good bye"]; + +var i; +for (i = 0; i < thisValues.length; i++) { + var j; + for (j = 0; j < thatValues.length; j++) { + var result = String.prototype.localeCompare.call(thisValues[i], thatValues[j]); + assert.sameValue((result === 0), (i === j), "localeCompare treats " + thisValues[i] + " and " + thatValues[j] + " as " + (result === 0 ? "equal" : "different") + "."); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js b/js/src/tests/test262/intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js new file mode 100644 index 0000000000..3910154616 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js @@ -0,0 +1,47 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1.1_6_1 +description: > + Tests that String.prototype.localeCompare throws the same + exceptions as Intl.Collator. +author: Norbert Lindenberg +---*/ + +var locales = [null, [NaN], ["i"], ["de_DE"]]; +var options = [ + {localeMatcher: null}, + {usage: "invalid"}, + {sensitivity: "invalid"} +]; + +locales.forEach(function (locales) { + var referenceError, error; + try { + var collator = new Intl.Collator(locales); + } catch (e) { + referenceError = e; + } + assert.notSameValue(referenceError, undefined, "Internal error: Expected exception was not thrown by Intl.Collator for locales " + locales + "."); + + assert.throws(referenceError.constructor, function() { + var result = "".localeCompare("", locales); + }, "String.prototype.localeCompare didn't throw exception for locales " + locales + "."); +}); + +options.forEach(function (options) { + var referenceError, error; + try { + var collator = new Intl.Collator([], options); + } catch (e) { + referenceError = e; + } + assert.notSameValue(referenceError, undefined, "Internal error: Expected exception was not thrown by Intl.Collator for options " + JSON.stringify(options) + "."); + + assert.throws(referenceError.constructor, function() { + var result = "".localeCompare("", [], options); + }, "String.prototype.localeCompare didn't throw exception for options " + JSON.stringify(options) + "."); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/shell.js b/js/src/tests/test262/intl402/String/prototype/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/shell.js diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/browser.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/browser.js diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/capital_I_with_dot.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/capital_I_with_dot.js new file mode 100644 index 0000000000..aa273e7a50 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/capital_I_with_dot.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleLowerCase supports mappings defined in SpecialCasings +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.20 +---*/ + +// Locale-sensitive for Turkish and Azeri. +assert.sameValue("\u0130".toLocaleLowerCase("und"), "\u0069\u0307", "LATIN CAPITAL LETTER I WITH DOT ABOVE"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/shell.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/shell.js diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Azeri.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Azeri.js new file mode 100644 index 0000000000..82989e6874 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Azeri.js @@ -0,0 +1,87 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleLowerCase supports language-sensitive mappings defined in SpecialCasings (Azeri) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.20 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Azeri). + +// LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) changed to LATIN SMALL LETTER I when lowercasing. +assert.sameValue( + "\u0130".toLocaleLowerCase("az"), + "i", + "LATIN CAPITAL LETTER I WITH DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) removed after LATIN CAPITAL LETTER I when lowercasing. +// - COMBINING DOT BELOW (U+0323), combining class 220 (Below) +// - PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE (U+101FD = D800 DDFD), combining class 220 (Below) +assert.sameValue( + "I\u0307".toLocaleLowerCase("az"), + "i", + "LATIN CAPITAL LETTER I followed by COMBINING DOT ABOVE" +); +assert.sameValue( + "I\u0323\u0307".toLocaleLowerCase("az"), + "i\u0323", + "LATIN CAPITAL LETTER I followed by COMBINING DOT BELOW, COMBINING DOT ABOVE" +); +assert.sameValue( + "I\uD800\uDDFD\u0307".toLocaleLowerCase("az"), + "i\uD800\uDDFD", + "LATIN CAPITAL LETTER I followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, COMBINING DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) not removed when character is preceded by a character of combining class 0. +assert.sameValue( + "IA\u0307".toLocaleLowerCase("az"), + "\u0131a\u0307", + "LATIN CAPITAL LETTER I followed by LATIN CAPITAL LETTER A, COMBINING DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) not removed when character is preceded by a character of combining class 230. +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "I\u0300\u0307".toLocaleLowerCase("az"), + "\u0131\u0300\u0307", + "LATIN CAPITAL LETTER I followed by COMBINING GRAVE ACCENT, COMBINING DOT ABOVE" +); +assert.sameValue( + "I\uD834\uDD85\u0307".toLocaleLowerCase("az"), + "\u0131\uD834\uDD85\u0307", + "LATIN CAPITAL LETTER I followed by MUSICAL SYMBOL COMBINING DOIT, COMBINING DOT ABOVE" +); + + +// LATIN CAPITAL LETTER I changed to LATIN SMALL LETTER DOTLESS I (U+0131) when lowercasing. +assert.sameValue( + "I".toLocaleLowerCase("az"), + "\u0131", + "LATIN CAPITAL LETTER I" +); + + +// No changes when lowercasing LATIN SMALL LETTER I and LATIN SMALL LETTER DOTLESS I (U+0131). +assert.sameValue( + "i".toLocaleLowerCase("az"), + "i", + "LATIN SMALL LETTER I" +); +assert.sameValue( + "\u0131".toLocaleLowerCase("az"), + "\u0131", + "LATIN SMALL LETTER DOTLESS I" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Lithuanian.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Lithuanian.js new file mode 100644 index 0000000000..73f38e190c --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Lithuanian.js @@ -0,0 +1,195 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleLowerCase supports language-sensitive mappings defined in SpecialCasings (Lithuanian) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.20 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Lithuanian). + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character directly followed by character of combining class 230 (Above). +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +assert.sameValue( + "I\u0300".toLocaleLowerCase("lt"), + "i\u0307\u0300", + "LATIN CAPITAL LETTER I followed by COMBINING GRAVE ACCENT" +); +assert.sameValue( + "J\u0300".toLocaleLowerCase("lt"), + "j\u0307\u0300", + "LATIN CAPITAL LETTER J followed by COMBINING GRAVE ACCENT" +); +assert.sameValue( + "\u012E\u0300".toLocaleLowerCase("lt"), + "\u012F\u0307\u0300", + "LATIN CAPITAL LETTER I WITH OGONEK followed by COMBINING GRAVE ACCENT" +); + + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character directly followed by character of combining class 230 (Above). +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "I\uD834\uDD85".toLocaleLowerCase("lt"), + "i\u0307\uD834\uDD85", + "LATIN CAPITAL LETTER I followed by MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "J\uD834\uDD85".toLocaleLowerCase("lt"), + "j\u0307\uD834\uDD85", + "LATIN CAPITAL LETTER J followed by MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "\u012E\uD834\uDD85".toLocaleLowerCase("lt"), + "\u012F\u0307\uD834\uDD85", + "LATIN CAPITAL LETTER I WITH OGONEK followed by MUSICAL SYMBOL COMBINING DOIT" +); + + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character not directly followed by character of combining class 230 (Above). +// - COMBINING RING BELOW (U+0325), combining class 220 (Below) +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +assert.sameValue( + "I\u0325\u0300".toLocaleLowerCase("lt"), + "i\u0307\u0325\u0300", + "LATIN CAPITAL LETTER I followed by COMBINING RING BELOW, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "J\u0325\u0300".toLocaleLowerCase("lt"), + "j\u0307\u0325\u0300", + "LATIN CAPITAL LETTER J followed by COMBINING RING BELOW, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "\u012E\u0325\u0300".toLocaleLowerCase("lt"), + "\u012F\u0307\u0325\u0300", + "LATIN CAPITAL LETTER I WITH OGONEK followed by COMBINING RING BELOW, COMBINING GRAVE ACCENT" +); + + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character not directly followed by character of combining class 230 (Above). +// - PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE (U+101FD, D800 DDFD), combining class 220 (Below) +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +assert.sameValue( + "I\uD800\uDDFD\u0300".toLocaleLowerCase("lt"), + "i\u0307\uD800\uDDFD\u0300", + "LATIN CAPITAL LETTER I followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "J\uD800\uDDFD\u0300".toLocaleLowerCase("lt"), + "j\u0307\uD800\uDDFD\u0300", + "LATIN CAPITAL LETTER J followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "\u012E\uD800\uDDFD\u0300".toLocaleLowerCase("lt"), + "\u012F\u0307\uD800\uDDFD\u0300", + "LATIN CAPITAL LETTER I WITH OGONEK followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, COMBINING GRAVE ACCENT" +); + + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character not directly followed by character of combining class 230 (Above). +// - COMBINING RING BELOW (U+0325), combining class 220 (Below) +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "I\u0325\uD834\uDD85".toLocaleLowerCase("lt"), + "i\u0307\u0325\uD834\uDD85", + "LATIN CAPITAL LETTER I followed by COMBINING RING BELOW, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "J\u0325\uD834\uDD85".toLocaleLowerCase("lt"), + "j\u0307\u0325\uD834\uDD85", + "LATIN CAPITAL LETTER J followed by COMBINING RING BELOW, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "\u012E\u0325\uD834\uDD85".toLocaleLowerCase("lt"), + "\u012F\u0307\u0325\uD834\uDD85", + "LATIN CAPITAL LETTER I WITH OGONEK followed by COMBINING RING BELOW, MUSICAL SYMBOL COMBINING DOIT" +); + + +// COMBINING DOT ABOVE added when lowercasing capital I, J and I WITH OGONEK (U+012E). +// Character not directly followed by character of combining class 230 (Above). +// - PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE (U+101FD, D800 DDFD), combining class 220 (Below) +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "I\uD800\uDDFD\uD834\uDD85".toLocaleLowerCase("lt"), + "i\u0307\uD800\uDDFD\uD834\uDD85", + "LATIN CAPITAL LETTER I followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "J\uD800\uDDFD\uD834\uDD85".toLocaleLowerCase("lt"), + "j\u0307\uD800\uDDFD\uD834\uDD85", + "LATIN CAPITAL LETTER J followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "\u012E\uD800\uDDFD\uD834\uDD85".toLocaleLowerCase("lt"), + "\u012F\u0307\uD800\uDDFD\uD834\uDD85", + "LATIN CAPITAL LETTER I WITH OGONEK followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, MUSICAL SYMBOL COMBINING DOIT" +); + + +// COMBINING DOT ABOVE not added when character is followed by a character of combining class 0. +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +assert.sameValue( + "IA\u0300".toLocaleLowerCase("lt"), + "ia\u0300", + "LATIN CAPITAL LETTER I followed by LATIN CAPITAL LETTER A, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "JA\u0300".toLocaleLowerCase("lt"), + "ja\u0300", + "LATIN CAPITAL LETTER J followed by LATIN CAPITAL LETTER A, COMBINING GRAVE ACCENT" +); +assert.sameValue( + "\u012EA\u0300".toLocaleLowerCase("lt"), + "\u012Fa\u0300", + "LATIN CAPITAL LETTER I WITH OGONEK followed by LATIN CAPITAL LETTER A, COMBINING GRAVE ACCENT" +); + + +// COMBINING DOT ABOVE not added when character is followed by a character of combining class 0. +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "IA\uD834\uDD85".toLocaleLowerCase("lt"), + "ia\uD834\uDD85", + "LATIN CAPITAL LETTER I followed by LATIN CAPITAL LETTER A, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "JA\uD834\uDD85".toLocaleLowerCase("lt"), + "ja\uD834\uDD85", + "LATIN CAPITAL LETTER J followed by LATIN CAPITAL LETTER A, MUSICAL SYMBOL COMBINING DOIT" +); +assert.sameValue( + "\u012EA\uD834\uDD85".toLocaleLowerCase("lt"), + "\u012Fa\uD834\uDD85", + "LATIN CAPITAL LETTER I WITH OGONEK (U+012E) followed by LATIN CAPITAL LETTER A, MUSICAL SYMBOL COMBINING DOIT" +); + + +// Precomposed characters with accents above. +assert.sameValue( + "\u00CC".toLocaleLowerCase("lt"), + "\u0069\u0307\u0300", + "LATIN CAPITAL LETTER I WITH GRAVE" +); +assert.sameValue( + "\u00CD".toLocaleLowerCase("lt"), + "\u0069\u0307\u0301", + "LATIN CAPITAL LETTER I WITH ACUTE" +); +assert.sameValue( + "\u0128".toLocaleLowerCase("lt"), + "\u0069\u0307\u0303", + "LATIN CAPITAL LETTER I WITH TILDE" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Turkish.js b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Turkish.js new file mode 100644 index 0000000000..bbd4578243 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleLowerCase/special_casing_Turkish.js @@ -0,0 +1,87 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleLowerCase supports language-sensitive mappings defined in SpecialCasings (Turkish) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.20 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Turkish). + +// LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) changed to LATIN SMALL LETTER I when lowercasing. +assert.sameValue( + "\u0130".toLocaleLowerCase("tr"), + "i", + "LATIN CAPITAL LETTER I WITH DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) removed after LATIN CAPITAL LETTER I when lowercasing. +// - COMBINING DOT BELOW (U+0323), combining class 220 (Below) +// - PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE (U+101FD = D800 DDFD), combining class 220 (Below) +assert.sameValue( + "I\u0307".toLocaleLowerCase("tr"), + "i", + "LATIN CAPITAL LETTER I followed by COMBINING DOT ABOVE" +); +assert.sameValue( + "I\u0323\u0307".toLocaleLowerCase("tr"), + "i\u0323", + "LATIN CAPITAL LETTER I followed by COMBINING DOT BELOW, COMBINING DOT ABOVE" +); +assert.sameValue( + "I\uD800\uDDFD\u0307".toLocaleLowerCase("tr"), + "i\uD800\uDDFD", + "LATIN CAPITAL LETTER I followed by PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE, COMBINING DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) not removed when character is preceded by a character of combining class 0. +assert.sameValue( + "IA\u0307".toLocaleLowerCase("tr"), + "\u0131a\u0307", + "LATIN CAPITAL LETTER I followed by LATIN CAPITAL LETTER A, COMBINING DOT ABOVE" +); + + +// COMBINING DOT ABOVE (U+0307) not removed when character is preceded by a character of combining class 230. +// - COMBINING GRAVE ACCENT (U+0300), combining class 230 (Above) +// - MUSICAL SYMBOL COMBINING DOIT (U+1D185, D834 DD85), combining class 230 (Above) +assert.sameValue( + "I\u0300\u0307".toLocaleLowerCase("tr"), + "\u0131\u0300\u0307", + "LATIN CAPITAL LETTER I followed by COMBINING GRAVE ACCENT, COMBINING DOT ABOVE" +); +assert.sameValue( + "I\uD834\uDD85\u0307".toLocaleLowerCase("tr"), + "\u0131\uD834\uDD85\u0307", + "LATIN CAPITAL LETTER I followed by MUSICAL SYMBOL COMBINING DOIT, COMBINING DOT ABOVE" +); + + +// LATIN CAPITAL LETTER I changed to LATIN SMALL LETTER DOTLESS I (U+0131) when lowercasing. +assert.sameValue( + "I".toLocaleLowerCase("tr"), + "\u0131", + "LATIN CAPITAL LETTER I" +); + + +// No changes when lowercasing LATIN SMALL LETTER I and LATIN SMALL LETTER DOTLESS I (U+0131). +assert.sameValue( + "i".toLocaleLowerCase("tr"), + "i", + "LATIN SMALL LETTER I" +); +assert.sameValue( + "\u0131".toLocaleLowerCase("tr"), + "\u0131", + "LATIN SMALL LETTER DOTLESS I" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/browser.js b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/browser.js diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/shell.js b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/shell.js diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Azeri.js b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Azeri.js new file mode 100644 index 0000000000..8b5021555a --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Azeri.js @@ -0,0 +1,47 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleUpperCase supports language-sensitive mappings defined in SpecialCasings (Azeri) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.21 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Azeri). + +// LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) not changed when uppercasing. +assert.sameValue( + "\u0130".toLocaleUpperCase("az"), + "\u0130", + "LATIN CAPITAL LETTER I WITH DOT ABOVE" +); + + +// LATIN CAPITAL LETTER I not changed when uppercasing. +assert.sameValue( + "I".toLocaleUpperCase("az"), + "I", + "LATIN CAPITAL LETTER I" +); + + +// LATIN SMALL LETTER I changed to LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) when uppercasing. +assert.sameValue( + "i".toLocaleUpperCase("az"), + "\u0130", + "LATIN SMALL LETTER I" +); + + +// LATIN SMALL LETTER DOTLESS I (U+0131) changed to LATIN CAPITAL LETTER I when uppercasing. +assert.sameValue( + "\u0131".toLocaleUpperCase("az"), + "I", + "LATIN SMALL LETTER DOTLESS I" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian.js b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian.js new file mode 100644 index 0000000000..2dfefd9851 --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian.js @@ -0,0 +1,115 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleUpperCase supports language-sensitive mappings defined in SpecialCasings (Lithuanian) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.21 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Lithuanian). + +// COMBINING DOT ABOVE (U+0307) not removed when uppercasing capital I and J. +assert.sameValue( + "I\u0307".toLocaleUpperCase("lt"), + "I\u0307", + "COMBINING DOT ABOVE preceded by LATIN CAPITAL LETTER I" +); +assert.sameValue( + "J\u0307".toLocaleUpperCase("lt"), + "J\u0307", + "COMBINING DOT ABOVE preceded by LATIN CAPITAL LETTER J" +); + + +// Code points with Soft_Dotted property (Unicode 5.1, PropList.txt) +var softDotted = [ + "\u0069", "\u006A", // LATIN SMALL LETTER I..LATIN SMALL LETTER J + "\u012F", // LATIN SMALL LETTER I WITH OGONEK + "\u0249", // LATIN SMALL LETTER J WITH STROKE + "\u0268", // LATIN SMALL LETTER I WITH STROKE + "\u029D", // LATIN SMALL LETTER J WITH CROSSED-TAIL + "\u02B2", // MODIFIER LETTER SMALL J + "\u03F3", // GREEK LETTER YOT + "\u0456", // CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + "\u0458", // CYRILLIC SMALL LETTER JE + "\u1D62", // LATIN SUBSCRIPT SMALL LETTER I + "\u1D96", // LATIN SMALL LETTER I WITH RETROFLEX HOOK + "\u1DA4", // MODIFIER LETTER SMALL I WITH STROKE + "\u1DA8", // MODIFIER LETTER SMALL J WITH CROSSED-TAIL + "\u1E2D", // LATIN SMALL LETTER I WITH TILDE BELOW + "\u1ECB", // LATIN SMALL LETTER I WITH DOT BELOW + "\u2071", // SUPERSCRIPT LATIN SMALL LETTER I + "\u2148", "\u2149", // DOUBLE-STRUCK ITALIC SMALL I..DOUBLE-STRUCK ITALIC SMALL J + "\u2C7C", // LATIN SUBSCRIPT SMALL LETTER J + "\uD835\uDC22", "\uD835\uDC23", // MATHEMATICAL BOLD SMALL I..MATHEMATICAL BOLD SMALL J + "\uD835\uDC56", "\uD835\uDC57", // MATHEMATICAL ITALIC SMALL I..MATHEMATICAL ITALIC SMALL J + "\uD835\uDC8A", "\uD835\uDC8B", // MATHEMATICAL BOLD ITALIC SMALL I..MATHEMATICAL BOLD ITALIC SMALL J + "\uD835\uDCBE", "\uD835\uDCBF", // MATHEMATICAL SCRIPT SMALL I..MATHEMATICAL SCRIPT SMALL J + "\uD835\uDCF2", "\uD835\uDCF3", // MATHEMATICAL BOLD SCRIPT SMALL I..MATHEMATICAL BOLD SCRIPT SMALL J + "\uD835\uDD26", "\uD835\uDD27", // MATHEMATICAL FRAKTUR SMALL I..MATHEMATICAL FRAKTUR SMALL J + "\uD835\uDD5A", "\uD835\uDD5B", // MATHEMATICAL DOUBLE-STRUCK SMALL I..MATHEMATICAL DOUBLE-STRUCK SMALL J + "\uD835\uDD8E", "\uD835\uDD8F", // MATHEMATICAL BOLD FRAKTUR SMALL I..MATHEMATICAL BOLD FRAKTUR SMALL J + "\uD835\uDDC2", "\uD835\uDDC3", // MATHEMATICAL SANS-SERIF SMALL I..MATHEMATICAL SANS-SERIF SMALL J + "\uD835\uDDF6", "\uD835\uDDF7", // MATHEMATICAL SANS-SERIF BOLD SMALL I..MATHEMATICAL SANS-SERIF BOLD SMALL J + "\uD835\uDE2A", "\uD835\uDE2B", // MATHEMATICAL SANS-SERIF ITALIC SMALL I..MATHEMATICAL SANS-SERIF ITALIC SMALL J + "\uD835\uDE5E", "\uD835\uDE5F", // MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL I..MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL J + "\uD835\uDE92", "\uD835\uDE93", // MATHEMATICAL MONOSPACE SMALL I..MATHEMATICAL MONOSPACE SMALL J +]; +assert.sameValue(softDotted.length, 46, "Total code points with Soft_Dotted property"); + +function charInfo(ch) { + function hexString(n) { + var s = n.toString(16).toUpperCase(); + return "0000".slice(s.length) + s; + } + + if (ch.length === 1) { + return "U+" + hexString(ch.charCodeAt(0)); + } + var high = ch.charCodeAt(0); + var low = ch.charCodeAt(1); + var codePoint = ((high << 10) + low) + (0x10000 - (0xD800 << 10) - 0xDC00); + return "U+" + hexString(codePoint) + " = " + hexString(high) + " " + hexString(low); +} + + +// COMBINING DOT ABOVE (U+0307) removed when preceded by Soft_Dotted. +// Character directly preceded by Soft_Dotted. +for (var i = 0; i < softDotted.length; ++i) { + assert.sameValue( + (softDotted[i] + "\u0307").toLocaleUpperCase("lt"), + softDotted[i].toLocaleUpperCase("und"), + "COMBINING DOT ABOVE preceded by Soft_Dotted (" + charInfo(softDotted[i]) + ")" + ); +} + + +// COMBINING DOT ABOVE (U+0307) removed if preceded by Soft_Dotted. +// Character not directly preceded by Soft_Dotted. +// - COMBINING DOT BELOW (U+0323), combining class 220 (Below) +for (var i = 0; i < softDotted.length; ++i) { + assert.sameValue( + (softDotted[i] + "\u0323\u0307").toLocaleUpperCase("lt"), + softDotted[i].toLocaleUpperCase("und") + "\u0323", + "COMBINING DOT ABOVE preceded by Soft_Dotted (" + charInfo(softDotted[i]) + "), COMBINING DOT BELOW" + ); +} + + +// COMBINING DOT ABOVE removed if preceded by Soft_Dotted. +// Character not directly preceded by Soft_Dotted. +// - PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE (U+101FD = D800 DDFD), combining class 220 (Below) +for (var i = 0; i < softDotted.length; ++i) { + assert.sameValue( + (softDotted[i] + "\uD800\uDDFD\u0307").toLocaleUpperCase("lt"), + softDotted[i].toLocaleUpperCase("und") + "\uD800\uDDFD", + "COMBINING DOT ABOVE preceded by Soft_Dotted (" + charInfo(softDotted[i]) + "), PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE" + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish.js b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish.js new file mode 100644 index 0000000000..12597a407a --- /dev/null +++ b/js/src/tests/test262/intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish.js @@ -0,0 +1,47 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Check if String.prototype.toLocaleUpperCase supports language-sensitive mappings defined in SpecialCasings (Turkish) +info: | + The result must be derived according to the case mappings in the Unicode character database (this explicitly + includes not only the UnicodeData.txt file, but also the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.21 +---*/ + +// SpecialCasing.txt, conditional, language-sensitive mappings (Turkish). + +// LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) not changed when uppercasing. +assert.sameValue( + "\u0130".toLocaleUpperCase("tr"), + "\u0130", + "LATIN CAPITAL LETTER I WITH DOT ABOVE" +); + + +// LATIN CAPITAL LETTER I not changed when uppercasing. +assert.sameValue( + "I".toLocaleUpperCase("tr"), + "I", + "LATIN CAPITAL LETTER I" +); + + +// LATIN SMALL LETTER I changed to LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130) when uppercasing. +assert.sameValue( + "i".toLocaleUpperCase("tr"), + "\u0130", + "LATIN SMALL LETTER I" +); + + +// LATIN SMALL LETTER DOTLESS I (U+0131) changed to LATIN CAPITAL LETTER I when uppercasing. +assert.sameValue( + "\u0131".toLocaleUpperCase("tr"), + "I", + "LATIN SMALL LETTER DOTLESS I" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/intl402/String/shell.js b/js/src/tests/test262/intl402/String/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/intl402/String/shell.js |