diff options
Diffstat (limited to 'test/built-ins/String/prototype/localeCompare')
10 files changed, 93 insertions, 91 deletions
diff --git a/test/built-ins/String/prototype/localeCompare/15.5.4.9_3.js b/test/built-ins/String/prototype/localeCompare/15.5.4.9_3.js index 06517ec3a..e1e5cdd26 100644 --- a/test/built-ins/String/prototype/localeCompare/15.5.4.9_3.js +++ b/test/built-ins/String/prototype/localeCompare/15.5.4.9_3.js @@ -13,11 +13,11 @@ var thisValues = ["a", "t", "u", "undefined", "UNDEFINED", "nicht definiert", "x var i; for (i = 0; i < thisValues.length; i++) { - var thisValue = thisValues[i]; - if (thisValue.localeCompare() !== thisValue.localeCompare(undefined)) { - $ERROR("String.prototype.localeCompare does not treat missing 'that' argument as undefined."); - } - if (thisValue.localeCompare(undefined) !== thisValue.localeCompare("undefined")) { - $ERROR("String.prototype.localeCompare does not treat undefined 'that' argument as \"undefined\"."); - } + var thisValue = thisValues[i]; + if (thisValue.localeCompare() !== thisValue.localeCompare(undefined)) { + $ERROR("String.prototype.localeCompare does not treat missing 'that' argument as undefined."); + } + if (thisValue.localeCompare(undefined) !== thisValue.localeCompare("undefined")) { + $ERROR("String.prototype.localeCompare does not treat undefined 'that' argument as \"undefined\"."); + } } diff --git a/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js b/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js index 365a80595..4123b624f 100644 --- a/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js +++ b/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js @@ -14,71 +14,71 @@ author: Norbert Lindenberg // pairs with characters not in Unicode 3.0 are commented out var pairs = [ - // example from Unicode 5.0, section 3.7, definition D70 - ["o\u0308", "ö"], - // examples from Unicode 5.0, chapter 3.11 - ["ä\u0323", "a\u0323\u0308"], - ["a\u0308\u0323", "a\u0323\u0308"], - ["ạ\u0308", "a\u0323\u0308"], - ["ä\u0306", "a\u0308\u0306"], - ["ă\u0308", "a\u0306\u0308"], - // example from Unicode 5.0, chapter 3.12 - ["\u1111\u1171\u11B6", "퓛"], - // examples from UTS 10, Unicode Collation Algorithm - ["Å", "Å"], - ["Å", "A\u030A"], - ["x\u031B\u0323", "x\u0323\u031B"], - ["ự", "ụ\u031B"], - ["ự", "u\u031B\u0323"], - ["ự", "ư\u0323"], - ["ự", "u\u0323\u031B"], - // examples from UAX 15, Unicode Normalization Forms - ["Ç", "C\u0327"], - ["q\u0307\u0323", "q\u0323\u0307"], - ["가", "\u1100\u1161"], - ["Å", "A\u030A"], - ["Ω", "Ω"], - ["Å", "A\u030A"], - ["ô", "o\u0302"], - ["ṩ", "s\u0323\u0307"], - ["ḋ\u0323", "d\u0323\u0307"], - ["ḋ\u0323", "ḍ\u0307"], - ["q\u0307\u0323", "q\u0323\u0307"], - // examples involving supplementary characters from UCD NormalizationTest.txt -// ["\uD834\uDD5E", "\uD834\uDD57\uD834\uDD65"], -// ["\uD87E\uDC2B", "北"] + // example from Unicode 5.0, section 3.7, definition D70 + ["o\u0308", "ö"], + // examples from Unicode 5.0, chapter 3.11 + ["ä\u0323", "a\u0323\u0308"], + ["a\u0308\u0323", "a\u0323\u0308"], + ["ạ\u0308", "a\u0323\u0308"], + ["ä\u0306", "a\u0308\u0306"], + ["ă\u0308", "a\u0306\u0308"], + // example from Unicode 5.0, chapter 3.12 + ["\u1111\u1171\u11B6", "퓛"], + // examples from UTS 10, Unicode Collation Algorithm + ["Å", "Å"], + ["Å", "A\u030A"], + ["x\u031B\u0323", "x\u0323\u031B"], + ["ự", "ụ\u031B"], + ["ự", "u\u031B\u0323"], + ["ự", "ư\u0323"], + ["ự", "u\u0323\u031B"], + // examples from UAX 15, Unicode Normalization Forms + ["Ç", "C\u0327"], + ["q\u0307\u0323", "q\u0323\u0307"], + ["가", "\u1100\u1161"], + ["Å", "A\u030A"], + ["Ω", "Ω"], + ["Å", "A\u030A"], + ["ô", "o\u0302"], + ["ṩ", "s\u0323\u0307"], + ["ḋ\u0323", "d\u0323\u0307"], + ["ḋ\u0323", "ḍ\u0307"], + ["q\u0307\u0323", "q\u0323\u0307"], + // examples involving supplementary characters from UCD NormalizationTest.txt + // ["\uD834\uDD5E", "\uD834\uDD57\uD834\uDD65"], + // ["\uD87E\uDC2B", "北"] ]; // Detect whether we are using locale-sensitive comparisons or a bitwise comparison -if("a".localeCompare("Z") < 0) { - // We are using locale-sensitive comparison, so all pairs should be canonically equivalent - var i; - for (i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - if (pair[0].localeCompare(pair[1]) !== 0) { - $ERROR("String.prototype.localeCompare considers " + pair[0] + " (" + toU(pair[0]) + - ") ≠ " + pair[1] + " (" + toU(pair[1]) + ")."); - } +if ("a".localeCompare("Z") < 0) { + // We are using locale-sensitive comparison, so all pairs should be canonically equivalent + var i; + for (i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + if (pair[0].localeCompare(pair[1]) !== 0) { + $ERROR("String.prototype.localeCompare considers " + pair[0] + " (" + toU(pair[0]) + + ") ≠ " + pair[1] + " (" + toU(pair[1]) + ")."); } + } } else { - // We are using bitwise comparison, so all pairs should not be equivalent - var i; - for (i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - if (pair[0].localeCompare(pair[1]) === 0) { - $ERROR("String.prototype.localeCompare considers " + pair[0] + " (" + toU(pair[0]) + - ") = " + pair[1] + " (" + toU(pair[1]) + ")."); - } + // We are using bitwise comparison, so all pairs should not be equivalent + var i; + for (i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + if (pair[0].localeCompare(pair[1]) === 0) { + $ERROR("String.prototype.localeCompare considers " + pair[0] + " (" + toU(pair[0]) + + ") = " + pair[1] + " (" + toU(pair[1]) + ")."); } + } } function toU(s) { - var result = ""; - var escape = "\\u0000"; - var i; - for (i = 0; i < s.length; i++) { - var hex = s.charCodeAt(i).toString(16); - result += escape.substring(0, escape.length - hex.length) + hex; - } - return result; + var result = ""; + var escape = "\\u0000"; + var i; + for (i = 0; i < s.length; i++) { + var hex = s.charCodeAt(i).toString(16); + result += escape.substring(0, escape.length - hex.length) + hex; + } + return result; } diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A10.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A10.js index 7af411b70..f50b0ff8d 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A10.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A10.js @@ -15,19 +15,21 @@ includes: [propertyHelper.js] ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (!(String.prototype.localeCompare.hasOwnProperty('length'))) { - $ERROR('#1: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.localeCompare.hasOwnProperty('length')); + $ERROR('#1: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.localeCompare.hasOwnProperty('length')); } // ////////////////////////////////////////////////////////////////////////////// var __obj = String.prototype.localeCompare.length; -verifyNotWritable(String.prototype.localeCompare, "length", null, function(){return "shifted";}); +verifyNotWritable(String.prototype.localeCompare, "length", null, function() { + return "shifted"; +}); ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (String.prototype.localeCompare.length !== __obj) { - $ERROR('#2: __obj = String.prototype.localeCompare.length; String.prototype.localeCompare.length = function(){return "shifted";}; String.prototype.localeCompare.length === __obj. Actual: '+String.prototype.localeCompare.length ); + $ERROR('#2: __obj = String.prototype.localeCompare.length; String.prototype.localeCompare.length = function(){return "shifted";}; String.prototype.localeCompare.length === __obj. Actual: ' + String.prototype.localeCompare.length); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A11.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A11.js index 4cd0b2bce..d2b382111 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A11.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A11.js @@ -10,7 +10,7 @@ description: Checking String.prototype.localeCompare.length ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (!(String.prototype.localeCompare.hasOwnProperty("length"))) { - $ERROR('#1: String.prototype.localeCompare.hasOwnProperty("length") return true. Actual: '+String.prototype.localeCompare.hasOwnProperty("length")); + $ERROR('#1: String.prototype.localeCompare.hasOwnProperty("length") return true. Actual: ' + String.prototype.localeCompare.hasOwnProperty("length")); } // ////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ if (!(String.prototype.localeCompare.hasOwnProperty("length"))) { ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (String.prototype.localeCompare.length !== 1) { - $ERROR('#2: String.prototype.localeCompare.length === 1. Actual: '+String.prototype.localeCompare.length ); + $ERROR('#2: String.prototype.localeCompare.length === 1. Actual: ' + String.prototype.localeCompare.length); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T1.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T1.js index 36c1e7019..c1d231158 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T1.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T1.js @@ -7,21 +7,21 @@ es5id: 15.5.4.9_A1_T1 description: This string is symbol and arguments are symbols ---*/ -var str1 = new String("h"); +var str1 = new String("h"); //CHECK#1 -var str2 = new String ("\x68"); -if (str1.localeCompare(str2)!==0){ - $ERROR('#1: var str1 = new String("h"); var str2 = new String ("\\x68"); str1.localeCompare(str2)===0. Actual: '+str1.localeCompare(str2)); +var str2 = new String("\x68"); +if (str1.localeCompare(str2) !== 0) { + $ERROR('#1: var str1 = new String("h"); var str2 = new String ("\\x68"); str1.localeCompare(str2)===0. Actual: ' + str1.localeCompare(str2)); } //CHECK#2 -var str2 = new String ("\u0068"); -if (str1.localeCompare(str2)!==0){ - $ERROR('#2: var str1 = new String("h"); var str2 = new String ("\\u0068"); str1.localeCompare(str2)===0. Actual: '+str1.localeCompare(str2)); +var str2 = new String("\u0068"); +if (str1.localeCompare(str2) !== 0) { + $ERROR('#2: var str1 = new String("h"); var str2 = new String ("\\u0068"); str1.localeCompare(str2)===0. Actual: ' + str1.localeCompare(str2)); } //CHECK#3 -var str2 = new String ("h"); -if (str1.localeCompare(str2)!==0){ - $ERROR('#3: var str1 = new String("h"); var str2 = new String ("h"); str1.localeCompare(str2)===0. Actual: '+str1.localeCompare(str2)); +var str2 = new String("h"); +if (str1.localeCompare(str2) !== 0) { + $ERROR('#3: var str1 = new String("h"); var str2 = new String ("h"); str1.localeCompare(str2)===0. Actual: ' + str1.localeCompare(str2)); } diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T2.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T2.js index be41eeb44..65aa3fbf3 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T2.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A1_T2.js @@ -12,6 +12,6 @@ description: > //CHECK#1 var str1 = "h"; var str2 = "H"; -if (str1.localeCompare(str2)!==-str2.localeCompare(str1)){ - $ERROR('#1.1: var str1 = "h"; var str2 = "H"; str1.localeCompare(str2)===-str2.localeCompare(str1). Actual: '+str1.localeCompare(str2)); +if (str1.localeCompare(str2) !== -str2.localeCompare(str1)) { + $ERROR('#1.1: var str1 = "h"; var str2 = "H"; str1.localeCompare(str2)===-str2.localeCompare(str1). Actual: ' + str1.localeCompare(str2)); } diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A6.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A6.js index 19001efc7..01b7a4006 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A6.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A6.js @@ -10,7 +10,7 @@ description: Checking String.prototype.localeCompare.prototype ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (String.prototype.localeCompare.prototype !== undefined) { - $ERROR('#1: String.prototype.localeCompare.prototype === undefined. Actual: '+String.prototype.localeCompare.prototype ); + $ERROR('#1: String.prototype.localeCompare.prototype === undefined. Actual: ' + String.prototype.localeCompare.prototype); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A7.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A7.js index b70beafa0..b52cc3ba6 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A7.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A7.js @@ -15,5 +15,5 @@ try { var __instance = new __FACTORY; $ERROR('#1: __FACTORY = String.prototype.localeCompare; __instance = new __FACTORY lead to throwing exception'); } catch (e) { - if (e instanceof Test262Error) throw e; + if (e instanceof Test262Error) throw e; } diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A8.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A8.js index 137c85bb3..928d8f703 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A8.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A8.js @@ -14,7 +14,7 @@ description: > ////////////////////////////////////////////////////////////////////////////// //CHECK#0 if (!(String.prototype.localeCompare.hasOwnProperty('length'))) { - $ERROR('#0: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.localeCompare.hasOwnProperty('length')); + $ERROR('#0: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.localeCompare.hasOwnProperty('length')); } // ////////////////////////////////////////////////////////////////////////////// @@ -30,14 +30,14 @@ if (String.prototype.localeCompare.propertyIsEnumerable('length')) { ////////////////////////////////////////////////////////////////////////////// // CHECK#2 -var count=0; +var count = 0; -for (var p in String.prototype.localeCompare){ - if (p==="length") count++; +for (var p in String.prototype.localeCompare) { + if (p === "length") count++; } if (count !== 0) { - $ERROR('#2: count=0; for (p in String.prototype.localeCompare){if (p==="length") count++;}; count === 0. Actual: '+count ); + $ERROR('#2: count=0; for (p in String.prototype.localeCompare){if (p==="length") count++;}; count === 0. Actual: ' + count); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A9.js b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A9.js index af1145e50..544ffe9d9 100644 --- a/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A9.js +++ b/test/built-ins/String/prototype/localeCompare/S15.5.4.9_A9.js @@ -14,7 +14,7 @@ description: > ////////////////////////////////////////////////////////////////////////////// //CHECK#0 if (!(String.prototype.localeCompare.hasOwnProperty('length'))) { - $ERROR('#0: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.localeCompare.hasOwnProperty('length')); + $ERROR('#0: String.prototype.localeCompare.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.localeCompare.hasOwnProperty('length')); } // ////////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ if (!delete String.prototype.localeCompare.length) { ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (String.prototype.localeCompare.hasOwnProperty('length')) { - $ERROR('#2: delete String.prototype.localeCompare.length; String.prototype.localeCompare.hasOwnProperty(\'length\') return false. Actual: '+String.prototype.localeCompare.hasOwnProperty('length')); + $ERROR('#2: delete String.prototype.localeCompare.length; String.prototype.localeCompare.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.localeCompare.hasOwnProperty('length')); } // ////////////////////////////////////////////////////////////////////////////// |