diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/toLowerCase')
30 files changed, 1061 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js new file mode 100644 index 0000000000..961b6abf84 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-string.prototype.tolowercase +description: > + Check if String.prototype.toLowerCase supports conditional mappings defined in SpecialCasings, + test Final_Sigma context with Mongolian Vowel Separator +info: | + The result must be derived according to the locale-insensitive case mappings in the Unicode Character + Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive + mappings in the SpecialCasings.txt file that accompanies it). +features: [u180e] +---*/ + +// SpecialCasing.txt, conditional, language-insensitive mappings. + +// <code>; <lower>; <title>; <upper>; (<condition_list>;)? # <comment> +// 03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA +// 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA + +// Final_Sigma is defined in Unicode 8.0, 3.13 Default Case Algorithms +// General_Category of Mongolian Vowel Separator is Cf (Format), characters in Cf are Case_Ignorable. + + +// Sigma preceded by Mongolian Vowel Separator. +assert.sameValue( + "A\u180E\u03A3".toLowerCase(), + "a\u180E\u03C2", + "Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR" +); +assert.sameValue( + "A\u180E\u03A3B".toLowerCase(), + "a\u180E\u03C3b", + "Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by LATIN CAPITAL LETTER B" +); + +// Sigma followed by Mongolian Vowel Separator. +assert.sameValue( + "A\u03A3\u180E".toLowerCase(), + "a\u03C2\u180E", + "Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR" +); +assert.sameValue( + "A\u03A3\u180EB".toLowerCase(), + "a\u03C3\u180Eb", + "Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B" +); + +// Sigma preceded and followed by Mongolian Vowel Separator. +assert.sameValue( + "A\u180E\u03A3\u180E".toLowerCase(), + "a\u180E\u03C2\u180E", + "Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR" +); +assert.sameValue( + "A\u180E\u03A3\u180EB".toLowerCase(), + "a\u180E\u03C3\u180Eb", + "Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A10.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A10.js new file mode 100644 index 0000000000..6fab668dcf --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A10.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The String.prototype.toLowerCase.length property has the attribute + ReadOnly +es5id: 15.5.4.16_A10 +description: > + Checking if varying the String.prototype.toLowerCase.length + property fails +includes: [propertyHelper.js] +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.toLowerCase.hasOwnProperty('length'))) { + throw new Test262Error('#1: String.prototype.toLowerCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toLowerCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __obj = String.prototype.toLowerCase.length; + +verifyNotWritable(String.prototype.toLowerCase, "length", null, function() { + return "shifted"; +}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toLowerCase.length !== __obj) { + throw new Test262Error('#2: __obj = String.prototype.toLowerCase.length; String.prototype.toLowerCase.length = function(){return "shifted";}; String.prototype.toLowerCase.length === __obj. Actual: ' + String.prototype.toLowerCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A11.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A11.js new file mode 100644 index 0000000000..04cde91c2f --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A11.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The length property of the toLowerCase method is 0 +es5id: 15.5.4.16_A11 +description: Checking String.prototype.toLowerCase.length +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.toLowerCase.hasOwnProperty("length"))) { + throw new Test262Error('#1: String.prototype.toLowerCase.hasOwnProperty("length") return true. Actual: ' + String.prototype.toLowerCase.hasOwnProperty("length")); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toLowerCase.length !== 0) { + throw new Test262Error('#2: String.prototype.toLowerCase.length === 0. Actual: ' + String.prototype.toLowerCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T1.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T1.js new file mode 100644 index 0000000000..2d6b0f4315 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T1 +description: Arguments is true, and instance is object +---*/ + +var __instance = new Object(true); + +__instance.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.toLowerCase() !== "true") { + throw new Test262Error('#1: __instance = new Object(true); __instance.toLowerCase = String.prototype.toLowerCase; __instance.toLowerCase() === "true". Actual: ' + __instance.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T10.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T10.js new file mode 100644 index 0000000000..1139c29567 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T10.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T10 +description: > + Call toLowerCase() function of object with overrode toString + function +---*/ + +var __obj = { + toString: function() { + return "\u0041B"; + } +} +__obj.toLowerCase = String.prototype.toLowerCase; + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.toLowerCase() !== "ab") { + throw new Test262Error('#1: var __obj = {toString:function(){return "\u0041B";}}; __obj.toLowerCase = String.prototype.toLowerCase; __obj.toLowerCase() ==="ab". Actual: ' + __obj.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T11.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T11.js new file mode 100644 index 0000000000..e39bfca7df --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T11.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T11 +description: > + Override toString function, toString throw exception, then call + toLowerCase() function for this object +---*/ + +var __obj = { + toString: function() { + throw "intostr"; + } +} +__obj.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var x = __obj.toLowerCase(); + throw new Test262Error('#1: "var x = __obj.toLowerCase()" lead to throwing exception'); +} catch (e) { + if (e !== "intostr") { + throw new Test262Error('#1.1: Exception === "intostr". Actual: ' + e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T12.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T12.js new file mode 100644 index 0000000000..355844e014 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T12.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T12 +description: > + Override toString and valueOf functions, valueOf throw exception, + then call toLowerCase() function for this object +---*/ + +var __obj = { + toString: function() { + return {}; + }, + valueOf: function() { + throw "intostr"; + } +} +__obj.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var x = __obj.toLowerCase(); + throw new Test262Error('#1: "var x = __obj.toLowerCase()" lead to throwing exception'); +} catch (e) { + if (e !== "intostr") { + throw new Test262Error('#1.1: Exception === "intostr". Actual: ' + e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T13.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T13.js new file mode 100644 index 0000000000..950d1d1875 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T13.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T13 +description: > + Override toString and valueOf functions, then call toLowerCase() + function for this object +---*/ + +var __obj = { + toString: function() { + return {}; + }, + valueOf: function() { + return 1; + } +} +__obj.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.toLowerCase() !== "1") { + throw new Test262Error('#1: var __obj = {toString:function(){return {};},valueOf:function(){return 1;}}; __obj.toLowerCase = String.prototype.toLowerCase; __obj.toLowerCase() ==="1". Actual: ' + __obj.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj.toLowerCase().length !== 1) { + throw new Test262Error('#2: var __obj = {toString:function(){return {};},valueOf:function(){return 1;}}; __obj.toLowerCase = String.prototype.toLowerCase; __obj.toLowerCase().length === 1. Actual: ' + __obj.toLowerCase().length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T14.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T14.js new file mode 100644 index 0000000000..d981fff7fd --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T14.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T14 +description: Call toLowerCase() function for RegExp object +---*/ + +var __reg = new RegExp("ABC"); +__reg.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__reg.toLowerCase() !== "/abc/") { + throw new Test262Error('#1: var __reg = new RegExp("ABC"); __reg.toLowerCase = String.prototype.toLowerCase; __reg.toLowerCase() === "/abc/". Actual: ' + __reg.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T2.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T2.js new file mode 100644 index 0000000000..8167201dec --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T2 +description: Instance is Boolean object +---*/ + +var __instance = new Boolean; + +__instance.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.toLowerCase() !== "false") { + throw new Test262Error('#1: __instance = new Boolean; __instance.toLowerCase = String.prototype.toLowerCase; __instance.toLowerCase() === "false". Actual: ' + __instance.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T3.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T3.js new file mode 100644 index 0000000000..b3c7a58a65 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T3 +description: Checking by using eval +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (eval("\"BJ\"").toLowerCase() !== "bj") { + throw new Test262Error('#1: eval("\\"BJ\\"").toLowerCase() === "bj". Actual: ' + eval("\"BJ\"").toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T4.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T4.js new file mode 100644 index 0000000000..339dec7f60 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T4.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T4 +description: > + Call toLowerCase() function without arguments of string and from + empty string +---*/ + +var __lowerCase = "".toLowerCase(); + +var __expected = ""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__lowerCase.length !== __expected.length) { + throw new Test262Error('#1: __lowerCase = "".toLowerCase(); __expected = ""; __lowerCase.length === __expected.length. Actual: ' + __lowerCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__lowerCase.index !== __expected.index) { + throw new Test262Error('#2: __lowerCase = "".toLowerCase(); __expected = ""; __lowerCase.index === __expected.index. Actual: ' + __lowerCase.index); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__lowerCase.input !== __expected.input) { + throw new Test262Error('#3: __lowerCase = "".toLowerCase(); __expected = ""; __lowerCase.input === __expected.input. Actual: ' + __lowerCase.input); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__lowerCase[0] !== __expected[0]) { + throw new Test262Error('#4: __lowerCase = "".toLowerCase(); __expected = ""; __lowerCase[0]===' + __expected[0] + '. Actual: ' + __lowerCase[0]); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T5.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T5.js new file mode 100644 index 0000000000..66c5e84851 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T5 +description: Call toLowerCase() function for function call +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(null) evaluates to "null" match(null) evaluates to match("null") +if (function() { + return "GnulLuNa" + }().toLowerCase() !== "gnulluna") { + throw new Test262Error('#1: function(){return "GnulLuNa"}().toLowerCase() === "gnulluna". Actual: ' + function() { + return "GnulLuNa" + }().toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T6.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T6.js new file mode 100644 index 0000000000..0447844c40 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T6.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T6 +description: Call toLowerCase() function of Number.NEGATIVE_INFINITY +---*/ + +Number.prototype.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((Number.NEGATIVE_INFINITY).toLowerCase() !== "-infinity") { + throw new Test262Error('#1: Number.prototype.toLowerCase = String.prototype.toLowerCase; (Number.NEGATIVE_INFINITY).toLowerCase() === "-infinity". Actual: ' + (Number.NEGATIVE_INFINITY).toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T7.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T7.js new file mode 100644 index 0000000000..239740c605 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T7 +description: Call toLowerCase() function of NaN +---*/ + +Number.prototype.toLowerCase = String.prototype.toLowerCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (NaN.toLowerCase() !== "nan") { + throw new Test262Error('#1: Number.prototype.toLowerCase = String.prototype.toLowerCase; NaN.toLowerCase()=== "nan". Actual: ' + NaN.toLowerCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T8.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T8.js new file mode 100644 index 0000000000..7ab6dfe263 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T8.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T8 +description: Call toLowerCase() function of Infinity +---*/ + +Number.prototype.toLowerCase = String.prototype.toLowerCase; + +if (Infinity.toLowerCase() !== "infinity") { + throw new Test262Error('#1: Number.prototype.toLowerCase = String.prototype.toLowerCase; Infinity.toLowerCase()=== "infinity". Actual: ' + Infinity.toLowerCase()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T9.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T9.js new file mode 100644 index 0000000000..088479f931 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A1_T9.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() +es5id: 15.5.4.16_A1_T9 +description: Call toLowerCase() function of string object +---*/ + +var __obj = { + valueOf: function() {}, + toString: void 0 +}; + +var __lowerCase = new String(__obj).toLowerCase(); + +var __expected = "undefined"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__lowerCase.length !== __expected.length) { + throw new Test262Error('#1: __obj = {valueOf:function(){}, toString:void 0}; __lowerCase = new String(__obj).toLowerCase(); __expected ="undefined"; __lowerCase.length === __expected.length. Actual: ' + __lowerCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__lowerCase.index !== __expected.index) { + throw new Test262Error('#2: __obj = {valueOf:function(){}, toString:void 0}; __lowerCase = new String(__obj).toLowerCase(); __expected ="undefined"; __lowerCase.index === __expected.index. Actual: ' + __lowerCase.index); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__lowerCase.input !== __expected.input) { + throw new Test262Error('#3: __obj = {valueOf:function(){}, toString:void 0}; __lowerCase = new String(__obj).toLowerCase(); __expected ="undefined"; __lowerCase.input === __expected.input. Actual: ' + __lowerCase.input); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +for (var index = 0; index < __expected.length; index++) { + if (__lowerCase[index] !== __expected[index]) { + throw new Test262Error('#4.' + index + ': __obj = {valueOf:function(){}, toString:void 0}; __lowerCase = new String(__obj).toLowerCase(); __expected ="undefined"; __lowerCase[' + index + ']===' + __expected[index] + '. Actual: ' + __lowerCase[index]); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A2_T1.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A2_T1.js new file mode 100644 index 0000000000..3985b12c0d --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A2_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase() return a string, but not a String object +es5id: 15.5.4.16_A2_T1 +description: Checking returned result +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ("Hello, WoRlD!".toLowerCase() !== "hello, world!") { + throw new Test262Error('#1: "Hello, WoRlD!".toLowerCase() === "hello, world!". Actual: ' + ("Hello, WoRlD!".toLowerCase())); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if ("Hello, WoRlD!".toLowerCase() !== String("hello, world!")) { + throw new Test262Error('#2: "Hello, WoRlD!".toLowerCase() === String("hello, world!"). Actual: ' + ("Hello, WoRlD!".toLowerCase())); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ("Hello, WoRlD!".toLowerCase() === new String("hello, world!")) { + throw new Test262Error('#3: "Hello, WoRlD!".toLowerCase() !== new String("hello, world!")'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A6.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A6.js new file mode 100644 index 0000000000..00240423bf --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase has not prototype property +es5id: 15.5.4.16_A6 +description: Checking String.prototype.toLowerCase.prototype +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (String.prototype.toLowerCase.prototype !== undefined) { + throw new Test262Error('#1: String.prototype.toLowerCase.prototype === undefined. Actual: ' + String.prototype.toLowerCase.prototype); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A7.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A7.js new file mode 100644 index 0000000000..398c46d58c --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A7.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toLowerCase can't be used as constructor +es5id: 15.5.4.16_A7 +description: Checking if creating the String.prototype.toLowerCase object fails +---*/ + +var __FACTORY = String.prototype.toLowerCase; + +try { + var __instance = new __FACTORY; + throw new Test262Error('#1: var __FACTORY = String.prototype.toLowerCase; "__instance = new __FACTORY" lead to throwing exception'); +} catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.1: var __FACTORY = String.prototype.toLowerCase; "__instance = new __FACTORY" throws a TypeError. Actual: ' + (e)); + } +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A8.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A8.js new file mode 100644 index 0000000000..2de059b88b --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A8.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The String.prototype.toLowerCase.length property has the attribute + DontEnum +es5id: 15.5.4.16_A8 +description: > + Checking if enumerating the String.prototype.toLowerCase.length + property fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.toLowerCase.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.toLowerCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toLowerCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (String.prototype.toLowerCase.propertyIsEnumerable('length')) { + throw new Test262Error('#1: String.prototype.toLowerCase.propertyIsEnumerable(\'length\') return false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#2 +var count = 0; + +for (var p in String.prototype.toLowerCase) { + if (p === "length") count++; +} + +if (count !== 0) { + throw new Test262Error('#2: count=0; for (p in String.prototype.toLowerCase){if (p==="length") count++;}; count === 0. Actual: ' + count); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A9.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A9.js new file mode 100644 index 0000000000..ef8e3382e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/S15.5.4.16_A9.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The String.prototype.toLowerCase.length property does not have the + attribute DontDelete +es5id: 15.5.4.16_A9 +description: > + Checking if deleting the String.prototype.toLowerCase.length + property fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.toLowerCase.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.toLowerCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toLowerCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!delete String.prototype.toLowerCase.length) { + throw new Test262Error('#1: delete String.prototype.toLowerCase.length return true'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toLowerCase.hasOwnProperty('length')) { + throw new Test262Error('#2: delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.toLowerCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/browser.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/browser.js diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/name.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/name.js new file mode 100644 index 0000000000..48f9222ed5 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 21.1.3.22 +description: > + String.prototype.toLowerCase.name is "toLowerCase". +info: | + String.prototype.toLowerCase ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(String.prototype.toLowerCase.name, "toLowerCase"); + +verifyNotEnumerable(String.prototype.toLowerCase, "name"); +verifyNotWritable(String.prototype.toLowerCase, "name"); +verifyConfigurable(String.prototype.toLowerCase, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/not-a-constructor.js new file mode 100644 index 0000000000..e9d92daf54 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + String.prototype.toLowerCase does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(String.prototype.toLowerCase), + false, + 'isConstructor(String.prototype.toLowerCase) must return false' +); + +assert.throws(TypeError, () => { + new String.prototype.toLowerCase(); +}, '`new String.prototype.toLowerCase()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/shell.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/shell.js diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing.js new file mode 100644 index 0000000000..7d0cf1ff16 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing.js @@ -0,0 +1,137 @@ +// 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.toLowerCase supports mappings defined in SpecialCasings +info: | + The result must be derived according to the locale-insensitive case mappings in the Unicode Character + Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive + mappings in the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.22 +---*/ + +// SpecialCasing.txt, except for conditional mappings. + +assert.sameValue("\u00DF".toLowerCase(), "\u00DF", "LATIN SMALL LETTER SHARP S"); + +assert.sameValue("\u0130".toLowerCase(), "\u0069\u0307", "LATIN CAPITAL LETTER I WITH DOT ABOVE"); + +assert.sameValue("\uFB00".toLowerCase(), "\uFB00", "LATIN SMALL LIGATURE FF"); +assert.sameValue("\uFB01".toLowerCase(), "\uFB01", "LATIN SMALL LIGATURE FI"); +assert.sameValue("\uFB02".toLowerCase(), "\uFB02", "LATIN SMALL LIGATURE FL"); +assert.sameValue("\uFB03".toLowerCase(), "\uFB03", "LATIN SMALL LIGATURE FFI"); +assert.sameValue("\uFB04".toLowerCase(), "\uFB04", "LATIN SMALL LIGATURE FFL"); +assert.sameValue("\uFB05".toLowerCase(), "\uFB05", "LATIN SMALL LIGATURE LONG S T"); +assert.sameValue("\uFB06".toLowerCase(), "\uFB06", "LATIN SMALL LIGATURE ST"); + +assert.sameValue("\u0587".toLowerCase(), "\u0587", "ARMENIAN SMALL LIGATURE ECH YIWN"); +assert.sameValue("\uFB13".toLowerCase(), "\uFB13", "ARMENIAN SMALL LIGATURE MEN NOW"); +assert.sameValue("\uFB14".toLowerCase(), "\uFB14", "ARMENIAN SMALL LIGATURE MEN ECH"); +assert.sameValue("\uFB15".toLowerCase(), "\uFB15", "ARMENIAN SMALL LIGATURE MEN INI"); +assert.sameValue("\uFB16".toLowerCase(), "\uFB16", "ARMENIAN SMALL LIGATURE VEW NOW"); +assert.sameValue("\uFB17".toLowerCase(), "\uFB17", "ARMENIAN SMALL LIGATURE MEN XEH"); + +assert.sameValue("\u0149".toLowerCase(), "\u0149", "LATIN SMALL LETTER N PRECEDED BY APOSTROPHE"); + +assert.sameValue("\u0390".toLowerCase(), "\u0390", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS"); +assert.sameValue("\u03B0".toLowerCase(), "\u03B0", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS"); + +assert.sameValue("\u01F0".toLowerCase(), "\u01F0", "LATIN SMALL LETTER J WITH CARON"); +assert.sameValue("\u1E96".toLowerCase(), "\u1E96", "LATIN SMALL LETTER H WITH LINE BELOW"); +assert.sameValue("\u1E97".toLowerCase(), "\u1E97", "LATIN SMALL LETTER T WITH DIAERESIS"); +assert.sameValue("\u1E98".toLowerCase(), "\u1E98", "LATIN SMALL LETTER W WITH RING ABOVE"); +assert.sameValue("\u1E99".toLowerCase(), "\u1E99", "LATIN SMALL LETTER Y WITH RING ABOVE"); +assert.sameValue("\u1E9A".toLowerCase(), "\u1E9A", "LATIN SMALL LETTER A WITH RIGHT HALF RING"); + +assert.sameValue("\u1F50".toLowerCase(), "\u1F50", "GREEK SMALL LETTER UPSILON WITH PSILI"); +assert.sameValue("\u1F52".toLowerCase(), "\u1F52", "GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA"); +assert.sameValue("\u1F54".toLowerCase(), "\u1F54", "GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA"); +assert.sameValue("\u1F56".toLowerCase(), "\u1F56", "GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI"); +assert.sameValue("\u1FB6".toLowerCase(), "\u1FB6", "GREEK SMALL LETTER ALPHA WITH PERISPOMENI"); +assert.sameValue("\u1FC6".toLowerCase(), "\u1FC6", "GREEK SMALL LETTER ETA WITH PERISPOMENI"); +assert.sameValue("\u1FD2".toLowerCase(), "\u1FD2", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA"); +assert.sameValue("\u1FD3".toLowerCase(), "\u1FD3", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA"); +assert.sameValue("\u1FD6".toLowerCase(), "\u1FD6", "GREEK SMALL LETTER IOTA WITH PERISPOMENI"); +assert.sameValue("\u1FD7".toLowerCase(), "\u1FD7", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI"); +assert.sameValue("\u1FE2".toLowerCase(), "\u1FE2", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA"); +assert.sameValue("\u1FE3".toLowerCase(), "\u1FE3", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA"); +assert.sameValue("\u1FE4".toLowerCase(), "\u1FE4", "GREEK SMALL LETTER RHO WITH PSILI"); +assert.sameValue("\u1FE6".toLowerCase(), "\u1FE6", "GREEK SMALL LETTER UPSILON WITH PERISPOMENI"); +assert.sameValue("\u1FE7".toLowerCase(), "\u1FE7", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI"); +assert.sameValue("\u1FF6".toLowerCase(), "\u1FF6", "GREEK SMALL LETTER OMEGA WITH PERISPOMENI"); + +assert.sameValue("\u1F80".toLowerCase(), "\u1F80", "GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F81".toLowerCase(), "\u1F81", "GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F82".toLowerCase(), "\u1F82", "GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F83".toLowerCase(), "\u1F83", "GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F84".toLowerCase(), "\u1F84", "GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F85".toLowerCase(), "\u1F85", "GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F86".toLowerCase(), "\u1F86", "GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F87".toLowerCase(), "\u1F87", "GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1F88".toLowerCase(), "\u1F80", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F89".toLowerCase(), "\u1F81", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8A".toLowerCase(), "\u1F82", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8B".toLowerCase(), "\u1F83", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8C".toLowerCase(), "\u1F84", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8D".toLowerCase(), "\u1F85", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8E".toLowerCase(), "\u1F86", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8F".toLowerCase(), "\u1F87", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1F90".toLowerCase(), "\u1F90", "GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F91".toLowerCase(), "\u1F91", "GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F92".toLowerCase(), "\u1F92", "GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F93".toLowerCase(), "\u1F93", "GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F94".toLowerCase(), "\u1F94", "GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F95".toLowerCase(), "\u1F95", "GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F96".toLowerCase(), "\u1F96", "GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F97".toLowerCase(), "\u1F97", "GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1F98".toLowerCase(), "\u1F90", "GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F99".toLowerCase(), "\u1F91", "GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9A".toLowerCase(), "\u1F92", "GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9B".toLowerCase(), "\u1F93", "GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9C".toLowerCase(), "\u1F94", "GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9D".toLowerCase(), "\u1F95", "GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9E".toLowerCase(), "\u1F96", "GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9F".toLowerCase(), "\u1F97", "GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1FA0".toLowerCase(), "\u1FA0", "GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA1".toLowerCase(), "\u1FA1", "GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA2".toLowerCase(), "\u1FA2", "GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA3".toLowerCase(), "\u1FA3", "GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA4".toLowerCase(), "\u1FA4", "GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA5".toLowerCase(), "\u1FA5", "GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA6".toLowerCase(), "\u1FA6", "GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA7".toLowerCase(), "\u1FA7", "GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1FA8".toLowerCase(), "\u1FA0", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1FA9".toLowerCase(), "\u1FA1", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAA".toLowerCase(), "\u1FA2", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAB".toLowerCase(), "\u1FA3", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAC".toLowerCase(), "\u1FA4", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAD".toLowerCase(), "\u1FA5", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAE".toLowerCase(), "\u1FA6", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAF".toLowerCase(), "\u1FA7", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1FB3".toLowerCase(), "\u1FB3", "GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FBC".toLowerCase(), "\u1FB3", "GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI"); +assert.sameValue("\u1FC3".toLowerCase(), "\u1FC3", "GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FCC".toLowerCase(), "\u1FC3", "GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI"); +assert.sameValue("\u1FF3".toLowerCase(), "\u1FF3", "GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FFC".toLowerCase(), "\u1FF3", "GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI"); + +assert.sameValue("\u1FB2".toLowerCase(), "\u1FB2", "GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FB4".toLowerCase(), "\u1FB4", "GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC2".toLowerCase(), "\u1FC2", "GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC4".toLowerCase(), "\u1FC4", "GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF2".toLowerCase(), "\u1FF2", "GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF4".toLowerCase(), "\u1FF4", "GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI"); + +assert.sameValue("\u1FB7".toLowerCase(), "\u1FB7", "GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC7".toLowerCase(), "\u1FC7", "GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF7".toLowerCase(), "\u1FF7", "GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing_conditional.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing_conditional.js new file mode 100644 index 0000000000..8356bbe54e --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/special_casing_conditional.js @@ -0,0 +1,103 @@ +// 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.toLowerCase supports conditional mappings defined in SpecialCasings +info: | + The result must be derived according to the locale-insensitive case mappings in the Unicode Character + Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive + mappings in the SpecialCasings.txt file that accompanies it). +es5id: 15.5.4.16 +es6id: 21.1.3.22 +---*/ + +// SpecialCasing.txt, conditional, language-insensitive mappings. + +// <code>; <lower>; <title>; <upper>; (<condition_list>;)? # <comment> +// 03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA +// 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA + +// Final_Sigma is defined in Unicode 5.1, 3.13 Default Case Algorithms. + +assert.sameValue( + "\u03A3".toLowerCase(), + "\u03C3", + "Single GREEK CAPITAL LETTER SIGMA" +); + +// Sigma preceded by Cased and zero or more Case_Ignorable. +assert.sameValue( + "A\u03A3".toLowerCase(), + "a\u03C2", + "Sigma preceded by LATIN CAPITAL LETTER A" +); +assert.sameValue( + "\uD835\uDCA2\u03A3".toLowerCase(), + "\uD835\uDCA2\u03C2", + "Sigma preceded by MATHEMATICAL SCRIPT CAPITAL G (D835 DCA2 = 1D4A2)" +); +assert.sameValue( + "A.\u03A3".toLowerCase(), + "a.\u03C2", + "Sigma preceded by FULL STOP" +); +assert.sameValue( + "A\u00AD\u03A3".toLowerCase(), + "a\u00AD\u03C2", + "Sigma preceded by SOFT HYPHEN (00AD)" +); +assert.sameValue( + "A\uD834\uDE42\u03A3".toLowerCase(), + "a\uD834\uDE42\u03C2", + "Sigma preceded by COMBINING GREEK MUSICAL TRISEME (D834 DE42 = 1D242)" +); +assert.sameValue( + "\u0345\u03A3".toLowerCase(), + "\u0345\u03C3", + "Sigma preceded by COMBINING GREEK YPOGEGRAMMENI (0345)" +); +assert.sameValue( + "\u0391\u0345\u03A3".toLowerCase(), + "\u03B1\u0345\u03C2", + "Sigma preceded by GREEK CAPITAL LETTER ALPHA (0391), COMBINING GREEK YPOGEGRAMMENI (0345)" +); + +// Sigma not followed by zero or more Case_Ignorable and then Cased. +assert.sameValue( + "A\u03A3B".toLowerCase(), + "a\u03C3b", + "Sigma followed by LATIN CAPITAL LETTER B" +); +assert.sameValue( + "A\u03A3\uD835\uDCA2".toLowerCase(), + "a\u03C3\uD835\uDCA2", + "Sigma followed by MATHEMATICAL SCRIPT CAPITAL G (D835 DCA2 = 1D4A2)" +); +assert.sameValue( + "A\u03A3.b".toLowerCase(), + "a\u03C3.b", + "Sigma followed by FULL STOP" +); +assert.sameValue( + "A\u03A3\u00ADB".toLowerCase(), + "a\u03C3\u00ADb", + "Sigma followed by SOFT HYPHEN (00AD)" +); +assert.sameValue( + "A\u03A3\uD834\uDE42B".toLowerCase(), + "a\u03C3\uD834\uDE42b", + "Sigma followed by COMBINING GREEK MUSICAL TRISEME (D834 DE42 = 1D242)" +); +assert.sameValue( + "A\u03A3\u0345".toLowerCase(), + "a\u03C2\u0345", + "Sigma followed by COMBINING GREEK YPOGEGRAMMENI (0345)" +); +assert.sameValue( + "A\u03A3\u0345\u0391".toLowerCase(), + "a\u03C3\u0345\u03B1", + "Sigma followed by COMBINING GREEK YPOGEGRAMMENI (0345), GREEK CAPITAL LETTER ALPHA (0391)" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/supplementary_plane.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/supplementary_plane.js new file mode 100644 index 0000000000..f1d7ece31f --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/supplementary_plane.js @@ -0,0 +1,59 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: String.prototype.toLowerCase() iterates over code points +info: | + 21.1.3.22 String.prototype.toLowerCase ( ) + + ... + 4. Let cpList be a List containing in order the code points as defined in + 6.1.4 of S, starting at the first element of S. + 5. For each code point c in cpList, if the Unicode Character Database + provides a language insensitive lower case equivalent of c then replace + c in cpList with that equivalent code point(s). +es6id: 21.1.3.22 +---*/ + +assert.sameValue("\uD801\uDC00".toLowerCase(), "\uD801\uDC28", "DESERET CAPITAL LETTER LONG I"); +assert.sameValue("\uD801\uDC01".toLowerCase(), "\uD801\uDC29", "DESERET CAPITAL LETTER LONG E"); +assert.sameValue("\uD801\uDC02".toLowerCase(), "\uD801\uDC2A", "DESERET CAPITAL LETTER LONG A"); +assert.sameValue("\uD801\uDC03".toLowerCase(), "\uD801\uDC2B", "DESERET CAPITAL LETTER LONG AH"); +assert.sameValue("\uD801\uDC04".toLowerCase(), "\uD801\uDC2C", "DESERET CAPITAL LETTER LONG O"); +assert.sameValue("\uD801\uDC05".toLowerCase(), "\uD801\uDC2D", "DESERET CAPITAL LETTER LONG OO"); +assert.sameValue("\uD801\uDC06".toLowerCase(), "\uD801\uDC2E", "DESERET CAPITAL LETTER SHORT I"); +assert.sameValue("\uD801\uDC07".toLowerCase(), "\uD801\uDC2F", "DESERET CAPITAL LETTER SHORT E"); +assert.sameValue("\uD801\uDC08".toLowerCase(), "\uD801\uDC30", "DESERET CAPITAL LETTER SHORT A"); +assert.sameValue("\uD801\uDC09".toLowerCase(), "\uD801\uDC31", "DESERET CAPITAL LETTER SHORT AH"); +assert.sameValue("\uD801\uDC0A".toLowerCase(), "\uD801\uDC32", "DESERET CAPITAL LETTER SHORT O"); +assert.sameValue("\uD801\uDC0B".toLowerCase(), "\uD801\uDC33", "DESERET CAPITAL LETTER SHORT OO"); +assert.sameValue("\uD801\uDC0C".toLowerCase(), "\uD801\uDC34", "DESERET CAPITAL LETTER AY"); +assert.sameValue("\uD801\uDC0D".toLowerCase(), "\uD801\uDC35", "DESERET CAPITAL LETTER OW"); +assert.sameValue("\uD801\uDC0E".toLowerCase(), "\uD801\uDC36", "DESERET CAPITAL LETTER WU"); +assert.sameValue("\uD801\uDC0F".toLowerCase(), "\uD801\uDC37", "DESERET CAPITAL LETTER YEE"); +assert.sameValue("\uD801\uDC10".toLowerCase(), "\uD801\uDC38", "DESERET CAPITAL LETTER H"); +assert.sameValue("\uD801\uDC11".toLowerCase(), "\uD801\uDC39", "DESERET CAPITAL LETTER PEE"); +assert.sameValue("\uD801\uDC12".toLowerCase(), "\uD801\uDC3A", "DESERET CAPITAL LETTER BEE"); +assert.sameValue("\uD801\uDC13".toLowerCase(), "\uD801\uDC3B", "DESERET CAPITAL LETTER TEE"); +assert.sameValue("\uD801\uDC14".toLowerCase(), "\uD801\uDC3C", "DESERET CAPITAL LETTER DEE"); +assert.sameValue("\uD801\uDC15".toLowerCase(), "\uD801\uDC3D", "DESERET CAPITAL LETTER CHEE"); +assert.sameValue("\uD801\uDC16".toLowerCase(), "\uD801\uDC3E", "DESERET CAPITAL LETTER JEE"); +assert.sameValue("\uD801\uDC17".toLowerCase(), "\uD801\uDC3F", "DESERET CAPITAL LETTER KAY"); +assert.sameValue("\uD801\uDC18".toLowerCase(), "\uD801\uDC40", "DESERET CAPITAL LETTER GAY"); +assert.sameValue("\uD801\uDC19".toLowerCase(), "\uD801\uDC41", "DESERET CAPITAL LETTER EF"); +assert.sameValue("\uD801\uDC1A".toLowerCase(), "\uD801\uDC42", "DESERET CAPITAL LETTER VEE"); +assert.sameValue("\uD801\uDC1B".toLowerCase(), "\uD801\uDC43", "DESERET CAPITAL LETTER ETH"); +assert.sameValue("\uD801\uDC1C".toLowerCase(), "\uD801\uDC44", "DESERET CAPITAL LETTER THEE"); +assert.sameValue("\uD801\uDC1D".toLowerCase(), "\uD801\uDC45", "DESERET CAPITAL LETTER ES"); +assert.sameValue("\uD801\uDC1E".toLowerCase(), "\uD801\uDC46", "DESERET CAPITAL LETTER ZEE"); +assert.sameValue("\uD801\uDC1F".toLowerCase(), "\uD801\uDC47", "DESERET CAPITAL LETTER ESH"); +assert.sameValue("\uD801\uDC20".toLowerCase(), "\uD801\uDC48", "DESERET CAPITAL LETTER ZHEE"); +assert.sameValue("\uD801\uDC21".toLowerCase(), "\uD801\uDC49", "DESERET CAPITAL LETTER ER"); +assert.sameValue("\uD801\uDC22".toLowerCase(), "\uD801\uDC4A", "DESERET CAPITAL LETTER EL"); +assert.sameValue("\uD801\uDC23".toLowerCase(), "\uD801\uDC4B", "DESERET CAPITAL LETTER EM"); +assert.sameValue("\uD801\uDC24".toLowerCase(), "\uD801\uDC4C", "DESERET CAPITAL LETTER EN"); +assert.sameValue("\uD801\uDC25".toLowerCase(), "\uD801\uDC4D", "DESERET CAPITAL LETTER ENG"); +assert.sameValue("\uD801\uDC26".toLowerCase(), "\uD801\uDC4E", "DESERET CAPITAL LETTER OI"); +assert.sameValue("\uD801\uDC27".toLowerCase(), "\uD801\uDC4F", "DESERET CAPITAL LETTER EW"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toLowerCase/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/this-value-not-obj-coercible.js new file mode 100644 index 0000000000..454eb79544 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toLowerCase/this-value-not-obj-coercible.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-string.prototype.tolowercase +description: The "this" value must be object-coercible +info: | + 1. Let O be ? RequireObjectCoercible(this value). +---*/ + +var toLowerCase = String.prototype.toLowerCase; + +assert.sameValue(typeof toLowerCase, 'function'); + +assert.throws(TypeError, function() { + toLowerCase.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + toLowerCase.call(null); +}, 'null'); + +reportCompare(0, 0); |