diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/toUpperCase')
28 files changed, 904 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A10.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A10.js new file mode 100644 index 0000000000..4924ada0a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase.length property has the attribute + ReadOnly +es5id: 15.5.4.18_A10 +description: > + Checking if varying the String.prototype.toUpperCase.length + property fails +includes: [propertyHelper.js] +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.toUpperCase.hasOwnProperty('length'))) { + throw new Test262Error('#1: String.prototype.toUpperCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toUpperCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __obj = String.prototype.toUpperCase.length; + +verifyNotWritable(String.prototype.toUpperCase, "length", null, function() { + return "shifted"; +}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toUpperCase.length !== __obj) { + throw new Test262Error('#2: __obj = String.prototype.toUpperCase.length; String.prototype.toUpperCase.length = function(){return "shifted";}; String.prototype.toUpperCase.length === __obj. Actual: ' + String.prototype.toUpperCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A11.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A11.js new file mode 100644 index 0000000000..4dfabc024d --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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 toUpperCase method is 0 +es5id: 15.5.4.18_A11 +description: Checking String.prototype.toUpperCase.length +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.toUpperCase.hasOwnProperty("length"))) { + throw new Test262Error('#1: String.prototype.toUpperCase.hasOwnProperty("length") return true. Actual: ' + String.prototype.toUpperCase.hasOwnProperty("length")); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toUpperCase.length !== 0) { + throw new Test262Error('#2: String.prototype.toUpperCase.length === 0. Actual: ' + String.prototype.toUpperCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T1.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T1.js new file mode 100644 index 0000000000..6d4f92ae0f --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T1 +description: Arguments is true, and instance is object +---*/ + +var __instance = new Object(true); + +__instance.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.toUpperCase() !== "TRUE") { + throw new Test262Error('#1: __instance = new Object(true); __instance.toUpperCase = String.prototype.toUpperCase; __instance.toUpperCase() === "TRUE". Actual: ' + __instance.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T10.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T10.js new file mode 100644 index 0000000000..d978fb60b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T10.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toUpperCase() +es5id: 15.5.4.18_A1_T10 +description: > + Call toUpperCase() function of object with overrode toString + function +---*/ + +var __obj = { + toString: function() { + return "\u0041b"; + } +} +__obj.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.toUpperCase() !== "AB") { + throw new Test262Error('#1: var __obj = {toString:function(){return "\u0041b";}}; __obj.toUpperCase = String.prototype.toUpperCase; __obj.toUpperCase() ==="AB". Actual: ' + __obj.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T11.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T11.js new file mode 100644 index 0000000000..055b0d632e --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T11.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.toUpperCase() +es5id: 15.5.4.18_A1_T11 +description: > + Override toString function, toString throw exception, then call + toUpperCase() function for this object +---*/ + +var __obj = { + toString: function() { + throw "intostr"; + } +} +__obj.toUpperCase = String.prototype.toUpperCase; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var x = __obj.toUpperCase(); + throw new Test262Error('#1: "var x = __obj.toUpperCase()" 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/toUpperCase/S15.5.4.18_A1_T12.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T12.js new file mode 100644 index 0000000000..71d08bb170 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T12.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.toUpperCase() +es5id: 15.5.4.18_A1_T12 +description: > + Override toString and valueOf functions, valueOf throw exception, + then call toUpperCase() function for this object +---*/ + +var __obj = { + toString: function() { + return {}; + }, + valueOf: function() { + throw "intostr"; + } +} +__obj.toUpperCase = String.prototype.toUpperCase; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var x = __obj.toUpperCase(); + throw new Test262Error('#1: "var x = __obj.toUpperCase()" 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/toUpperCase/S15.5.4.18_A1_T13.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T13.js new file mode 100644 index 0000000000..233416cc02 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T13 +description: > + Override toString and valueOf functions, then call toUpperCase() + function for this object +---*/ + +var __obj = { + toString: function() { + return {}; + }, + valueOf: function() { + return 1; + } +} +__obj.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.toUpperCase() !== "1") { + throw new Test262Error('#1: var __obj = {toString:function(){return {};},valueOf:function(){return 1;}}; __obj.toUpperCase = String.prototype.toUpperCase; __obj.toUpperCase() ==="1". Actual: ' + __obj.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj.toUpperCase().length !== 1) { + throw new Test262Error('#2: var __obj = {toString:function(){return {};},valueOf:function(){return 1;}}; __obj.toUpperCase = String.prototype.toUpperCase; __obj.toUpperCase().length === 1. Actual: ' + __obj.toUpperCase().length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T14.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T14.js new file mode 100644 index 0000000000..51048d5ba2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T14.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.toUpperCase() +es5id: 15.5.4.18_A1_T14 +description: Call toUpperCase() function of RegExp object +---*/ + +var __reg = new RegExp("abc"); +__reg.toUpperCase = String.prototype.toUpperCase; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__reg.toUpperCase() !== "/ABC/") { + throw new Test262Error('#1: var __reg = new RegExp("abc"); __reg.toUpperCase = String.prototype.toUpperCase; __reg.toUpperCase() === "/ABC/". Actual: ' + __reg.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T2.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T2.js new file mode 100644 index 0000000000..e1ab874b41 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T2 +description: Instance is Boolean object +---*/ + +var __instance = new Boolean; + +__instance.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.toUpperCase() !== "FALSE") { + throw new Test262Error('#1: __instance = new Boolean; __instance.toUpperCase = String.prototype.toUpperCase; __instance.toUpperCase() === "FALSE". Actual: ' + __instance.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T3.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T3.js new file mode 100644 index 0000000000..0b4ed555f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T3 +description: Checking by using eval +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (eval("\"bj\"").toUpperCase() !== "BJ") { + throw new Test262Error('#1: eval("\\"bj\\"").toUpperCase() === "BJ". Actual: ' + eval("\"bj\"").toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T4.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T4.js new file mode 100644 index 0000000000..1de632e61d --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T4 +description: > + Call toUpperCase() function without arguments of string and from + empty string +---*/ + +var __lowerCase = "".toUpperCase(); + +var __expected = ""; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__lowerCase.length !== __expected.length) { + throw new Test262Error('#1: __lowerCase = "".toUpperCase(); __expected = ""; __lowerCase.length === __expected.length. Actual: ' + __lowerCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__lowerCase.index !== __expected.index) { + throw new Test262Error('#2: __lowerCase = "".toUpperCase(); __expected = ""; __lowerCase.index === __expected.index. Actual: ' + __lowerCase.index); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__lowerCase.input !== __expected.input) { + throw new Test262Error('#3: __lowerCase = "".toUpperCase(); __expected = ""; __lowerCase.input === __expected.input. Actual: ' + __lowerCase.input); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__lowerCase[0] !== __expected[0]) { + throw new Test262Error('#4: __lowerCase = "".toUpperCase(); __expected = ""; __lowerCase[0]===' + __expected[0] + '. Actual: ' + __lowerCase[0]); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T5.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T5.js new file mode 100644 index 0000000000..0e9e30fcb9 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T5 +description: Call toUpperCase() function of function call +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(null) evaluates to "null" match(null) evaluates to match("null") +if (function() { + return "GnulLuNa" + }().toUpperCase() !== "GNULLUNA") { + throw new Test262Error('#1: function(){return "GnulLuNa"}().toUpperCase() === "GNULLUNA". Actual: ' + function() { + return "GnulLuNa" + }().toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T6.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T6.js new file mode 100644 index 0000000000..9dd923681c --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T6 +description: Call toUpperCase() function of Number.NEGATIVE_INFINITY +---*/ + +Number.prototype.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ((Number.NEGATIVE_INFINITY).toUpperCase() !== "-INFINITY") { + throw new Test262Error('#1: Number.prototype.toUpperCase = String.prototype.toUpperCase; (Number.NEGATIVE_INFINITY).toUpperCase() === "-INFINITY". Actual: ' + (Number.NEGATIVE_INFINITY).toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T7.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T7.js new file mode 100644 index 0000000000..c7cf124363 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T7 +description: Call toUpperCase() function of NaN +---*/ + +Number.prototype.toUpperCase = String.prototype.toUpperCase; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (NaN.toUpperCase() !== "NAN") { + throw new Test262Error('#1: Number.prototype.toUpperCase = String.prototype.toUpperCase; NaN.toUpperCase()=== "NAN". Actual: ' + NaN.toUpperCase()); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T8.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T8.js new file mode 100644 index 0000000000..5ad34efd9c --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T8 +description: Call toUpperCase() function of Infinity; +---*/ + +Number.prototype.toUpperCase = String.prototype.toUpperCase; + +if (Infinity.toUpperCase() !== "INFINITY") { + throw new Test262Error('#1: Number.prototype.toUpperCase = String.prototype.toUpperCase; Infinity.toUpperCase()=== "INFINITY". Actual: ' + Infinity.toUpperCase()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T9.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A1_T9.js new file mode 100644 index 0000000000..be7e1feb12 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() +es5id: 15.5.4.18_A1_T9 +description: Call toUpperCase() function of string object +---*/ + +var __obj = { + valueOf: function() {}, + toString: void 0 +}; + +var __upperCase = new String(__obj).toUpperCase(); + +var __expected = "UNDEFINED"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__upperCase.length !== __expected.length) { + throw new Test262Error('#1: __obj = {valueOf:function(){}, toString:void 0}; __upperCase = new String(__obj).toUpperCase(); __expected ="UNDEFINED"; __upperCase.length === __expected.length. Actual: ' + __upperCase.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__upperCase.index !== __expected.index) { + throw new Test262Error('#2: __obj = {valueOf:function(){}, toString:void 0}; __upperCase = new String(__obj).toUpperCase(); __expected ="UNDEFINED"; __upperCase.index === __expected.index. Actual: ' + __upperCase.index); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__upperCase.input !== __expected.input) { + throw new Test262Error('#3: __obj = {valueOf:function(){}, toString:void 0}; __upperCase = new String(__obj).toUpperCase(); __expected ="UNDEFINED"; __upperCase.input === __expected.input. Actual: ' + __upperCase.input); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +for (var index = 0; index < __expected.length; index++) { + if (__upperCase[index] !== __expected[index]) { + throw new Test262Error('#4.' + index + ': __obj = {valueOf:function(){}, toString:void 0}; __upperCase = new String(__obj).toUpperCase(); __expected ="UNDEFINED"; __upperCase[' + index + ']===' + __expected[index] + '. Actual: ' + __upperCase[index]); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A2_T1.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A2_T1.js new file mode 100644 index 0000000000..3bc31c16c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase() return a string, but not a String object +es5id: 15.5.4.18_A2_T1 +description: Checking returned result +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ("Hello, WoRlD!".toUpperCase() !== "HELLO, WORLD!") { + throw new Test262Error('#1: "Hello, WoRlD!".toUpperCase() === "HELLO, WORLD!". Actual: ' + ("Hello, WoRlD!".toUpperCase())); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if ("Hello, WoRlD!".toUpperCase() !== String("HELLO, WORLD!")) { + throw new Test262Error('#2: "Hello, WoRlD!".toUpperCase() === String("HELLO, WORLD!"). Actual: ' + ("Hello, WoRlD!".toUpperCase())); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ("Hello, WoRlD!".toUpperCase() === new String("HELLO, WORLD!")) { + throw new Test262Error('#3: "Hello, WoRlD!".toUpperCase() !== new String("HELLO, WORLD!")'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A6.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A6.js new file mode 100644 index 0000000000..d10a0c5625 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase has not prototype property +es5id: 15.5.4.18_A6 +description: Checking String.prototype.toUpperCase.prototype +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (String.prototype.toUpperCase.prototype !== undefined) { + throw new Test262Error('#1: String.prototype.toUpperCase.prototype === undefined. Actual: ' + String.prototype.toUpperCase.prototype); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A7.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A7.js new file mode 100644 index 0000000000..b4f007741f --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase can't be used as constructor +es5id: 15.5.4.18_A7 +description: Checking if creating the String.prototype.toUpperCase object fails +---*/ + +var __FACTORY = String.prototype.toUpperCase; + +try { + var __instance = new __FACTORY; + throw new Test262Error('#1: var __FACTORY = String.prototype.toUpperCase; "__instance = new __FACTORY" lead to throwing exception'); +} catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.1: var __FACTORY = String.prototype.toUpperCase; "__instance = new __FACTORY" throw a TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A8.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A8.js new file mode 100644 index 0000000000..a44f896dc2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase.length property has the attribute + DontEnum +es5id: 15.5.4.18_A8 +description: > + Checking if enumerating the String.prototype.toUpperCase.length + property fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.toUpperCase.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.toUpperCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toUpperCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (String.prototype.toUpperCase.propertyIsEnumerable('length')) { + throw new Test262Error('#1: String.prototype.toUpperCase.propertyIsEnumerable(\'length\') return false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#2 +var count = 0; + +for (var p in String.prototype.toUpperCase) { + if (p === "length") count++; +} + +if (count !== 0) { + throw new Test262Error('#2: count=0; for (p in String.prototype.toUpperCase){if (p==="length") count++;}; count === 0. Actual: ' + count); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A9.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_A9.js new file mode 100644 index 0000000000..1da084fcf5 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/S15.5.4.18_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.toUpperCase.length property does not have the + attribute DontDelete +es5id: 15.5.4.18_A9 +description: > + Checking if deleting the String.prototype.toUpperCase.length + property fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.toUpperCase.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.toUpperCase.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.toUpperCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!delete String.prototype.toUpperCase.length) { + throw new Test262Error('#1: delete String.prototype.toUpperCase.length return true'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.toUpperCase.hasOwnProperty('length')) { + throw new Test262Error('#2: delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.toUpperCase.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/browser.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/browser.js diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/name.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/name.js new file mode 100644 index 0000000000..9e2922beb0 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/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.24 +description: > + String.prototype.toUpperCase.name is "toUpperCase". +info: | + String.prototype.toUpperCase ( ) + + 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.toUpperCase.name, "toUpperCase"); + +verifyNotEnumerable(String.prototype.toUpperCase, "name"); +verifyNotWritable(String.prototype.toUpperCase, "name"); +verifyConfigurable(String.prototype.toUpperCase, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/not-a-constructor.js new file mode 100644 index 0000000000..4820c87b12 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/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.toUpperCase 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.toUpperCase), + false, + 'isConstructor(String.prototype.toUpperCase) must return false' +); + +assert.throws(TypeError, () => { + new String.prototype.toUpperCase(); +}, '`new String.prototype.toUpperCase()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/shell.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/shell.js diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/special_casing.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/special_casing.js new file mode 100644 index 0000000000..520b6b33e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/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.toUpperCase 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.18 +es6id: 21.1.3.24 +---*/ + +// SpecialCasing.txt, except for conditional mappings. + +assert.sameValue("\u00DF".toUpperCase(), "\u0053\u0053", "LATIN SMALL LETTER SHARP S"); + +assert.sameValue("\u0130".toUpperCase(), "\u0130", "LATIN CAPITAL LETTER I WITH DOT ABOVE"); + +assert.sameValue("\uFB00".toUpperCase(), "\u0046\u0046", "LATIN SMALL LIGATURE FF"); +assert.sameValue("\uFB01".toUpperCase(), "\u0046\u0049", "LATIN SMALL LIGATURE FI"); +assert.sameValue("\uFB02".toUpperCase(), "\u0046\u004C", "LATIN SMALL LIGATURE FL"); +assert.sameValue("\uFB03".toUpperCase(), "\u0046\u0046\u0049", "LATIN SMALL LIGATURE FFI"); +assert.sameValue("\uFB04".toUpperCase(), "\u0046\u0046\u004C", "LATIN SMALL LIGATURE FFL"); +assert.sameValue("\uFB05".toUpperCase(), "\u0053\u0054", "LATIN SMALL LIGATURE LONG S T"); +assert.sameValue("\uFB06".toUpperCase(), "\u0053\u0054", "LATIN SMALL LIGATURE ST"); + +assert.sameValue("\u0587".toUpperCase(), "\u0535\u0552", "ARMENIAN SMALL LIGATURE ECH YIWN"); +assert.sameValue("\uFB13".toUpperCase(), "\u0544\u0546", "ARMENIAN SMALL LIGATURE MEN NOW"); +assert.sameValue("\uFB14".toUpperCase(), "\u0544\u0535", "ARMENIAN SMALL LIGATURE MEN ECH"); +assert.sameValue("\uFB15".toUpperCase(), "\u0544\u053B", "ARMENIAN SMALL LIGATURE MEN INI"); +assert.sameValue("\uFB16".toUpperCase(), "\u054E\u0546", "ARMENIAN SMALL LIGATURE VEW NOW"); +assert.sameValue("\uFB17".toUpperCase(), "\u0544\u053D", "ARMENIAN SMALL LIGATURE MEN XEH"); + +assert.sameValue("\u0149".toUpperCase(), "\u02BC\u004E", "LATIN SMALL LETTER N PRECEDED BY APOSTROPHE"); + +assert.sameValue("\u0390".toUpperCase(), "\u0399\u0308\u0301", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS"); +assert.sameValue("\u03B0".toUpperCase(), "\u03A5\u0308\u0301", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS"); + +assert.sameValue("\u01F0".toUpperCase(), "\u004A\u030C", "LATIN SMALL LETTER J WITH CARON"); +assert.sameValue("\u1E96".toUpperCase(), "\u0048\u0331", "LATIN SMALL LETTER H WITH LINE BELOW"); +assert.sameValue("\u1E97".toUpperCase(), "\u0054\u0308", "LATIN SMALL LETTER T WITH DIAERESIS"); +assert.sameValue("\u1E98".toUpperCase(), "\u0057\u030A", "LATIN SMALL LETTER W WITH RING ABOVE"); +assert.sameValue("\u1E99".toUpperCase(), "\u0059\u030A", "LATIN SMALL LETTER Y WITH RING ABOVE"); +assert.sameValue("\u1E9A".toUpperCase(), "\u0041\u02BE", "LATIN SMALL LETTER A WITH RIGHT HALF RING"); + +assert.sameValue("\u1F50".toUpperCase(), "\u03A5\u0313", "GREEK SMALL LETTER UPSILON WITH PSILI"); +assert.sameValue("\u1F52".toUpperCase(), "\u03A5\u0313\u0300", "GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA"); +assert.sameValue("\u1F54".toUpperCase(), "\u03A5\u0313\u0301", "GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA"); +assert.sameValue("\u1F56".toUpperCase(), "\u03A5\u0313\u0342", "GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI"); +assert.sameValue("\u1FB6".toUpperCase(), "\u0391\u0342", "GREEK SMALL LETTER ALPHA WITH PERISPOMENI"); +assert.sameValue("\u1FC6".toUpperCase(), "\u0397\u0342", "GREEK SMALL LETTER ETA WITH PERISPOMENI"); +assert.sameValue("\u1FD2".toUpperCase(), "\u0399\u0308\u0300", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA"); +assert.sameValue("\u1FD3".toUpperCase(), "\u0399\u0308\u0301", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA"); +assert.sameValue("\u1FD6".toUpperCase(), "\u0399\u0342", "GREEK SMALL LETTER IOTA WITH PERISPOMENI"); +assert.sameValue("\u1FD7".toUpperCase(), "\u0399\u0308\u0342", "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI"); +assert.sameValue("\u1FE2".toUpperCase(), "\u03A5\u0308\u0300", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA"); +assert.sameValue("\u1FE3".toUpperCase(), "\u03A5\u0308\u0301", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA"); +assert.sameValue("\u1FE4".toUpperCase(), "\u03A1\u0313", "GREEK SMALL LETTER RHO WITH PSILI"); +assert.sameValue("\u1FE6".toUpperCase(), "\u03A5\u0342", "GREEK SMALL LETTER UPSILON WITH PERISPOMENI"); +assert.sameValue("\u1FE7".toUpperCase(), "\u03A5\u0308\u0342", "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI"); +assert.sameValue("\u1FF6".toUpperCase(), "\u03A9\u0342", "GREEK SMALL LETTER OMEGA WITH PERISPOMENI"); + +assert.sameValue("\u1F80".toUpperCase(), "\u1F08\u0399", "GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F81".toUpperCase(), "\u1F09\u0399", "GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F82".toUpperCase(), "\u1F0A\u0399", "GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F83".toUpperCase(), "\u1F0B\u0399", "GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F84".toUpperCase(), "\u1F0C\u0399", "GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F85".toUpperCase(), "\u1F0D\u0399", "GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F86".toUpperCase(), "\u1F0E\u0399", "GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F87".toUpperCase(), "\u1F0F\u0399", "GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1F88".toUpperCase(), "\u1F08\u0399", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F89".toUpperCase(), "\u1F09\u0399", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8A".toUpperCase(), "\u1F0A\u0399", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8B".toUpperCase(), "\u1F0B\u0399", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8C".toUpperCase(), "\u1F0C\u0399", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8D".toUpperCase(), "\u1F0D\u0399", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8E".toUpperCase(), "\u1F0E\u0399", "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F8F".toUpperCase(), "\u1F0F\u0399", "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1F90".toUpperCase(), "\u1F28\u0399", "GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F91".toUpperCase(), "\u1F29\u0399", "GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F92".toUpperCase(), "\u1F2A\u0399", "GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F93".toUpperCase(), "\u1F2B\u0399", "GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F94".toUpperCase(), "\u1F2C\u0399", "GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F95".toUpperCase(), "\u1F2D\u0399", "GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1F96".toUpperCase(), "\u1F2E\u0399", "GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1F97".toUpperCase(), "\u1F2F\u0399", "GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1F98".toUpperCase(), "\u1F28\u0399", "GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F99".toUpperCase(), "\u1F29\u0399", "GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9A".toUpperCase(), "\u1F2A\u0399", "GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9B".toUpperCase(), "\u1F2B\u0399", "GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9C".toUpperCase(), "\u1F2C\u0399", "GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9D".toUpperCase(), "\u1F2D\u0399", "GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9E".toUpperCase(), "\u1F2E\u0399", "GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1F9F".toUpperCase(), "\u1F2F\u0399", "GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1FA0".toUpperCase(), "\u1F68\u0399", "GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA1".toUpperCase(), "\u1F69\u0399", "GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA2".toUpperCase(), "\u1F6A\u0399", "GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA3".toUpperCase(), "\u1F6B\u0399", "GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA4".toUpperCase(), "\u1F6C\u0399", "GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA5".toUpperCase(), "\u1F6D\u0399", "GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA6".toUpperCase(), "\u1F6E\u0399", "GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FA7".toUpperCase(), "\u1F6F\u0399", "GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI"); + +assert.sameValue("\u1FA8".toUpperCase(), "\u1F68\u0399", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI"); +assert.sameValue("\u1FA9".toUpperCase(), "\u1F69\u0399", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAA".toUpperCase(), "\u1F6A\u0399", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAB".toUpperCase(), "\u1F6B\u0399", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAC".toUpperCase(), "\u1F6C\u0399", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAD".toUpperCase(), "\u1F6D\u0399", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAE".toUpperCase(), "\u1F6E\u0399", "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI"); +assert.sameValue("\u1FAF".toUpperCase(), "\u1F6F\u0399", "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI"); + +assert.sameValue("\u1FB3".toUpperCase(), "\u0391\u0399", "GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FBC".toUpperCase(), "\u0391\u0399", "GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI"); +assert.sameValue("\u1FC3".toUpperCase(), "\u0397\u0399", "GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FCC".toUpperCase(), "\u0397\u0399", "GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI"); +assert.sameValue("\u1FF3".toUpperCase(), "\u03A9\u0399", "GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI"); +assert.sameValue("\u1FFC".toUpperCase(), "\u03A9\u0399", "GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI"); + +assert.sameValue("\u1FB2".toUpperCase(), "\u1FBA\u0399", "GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FB4".toUpperCase(), "\u0386\u0399", "GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC2".toUpperCase(), "\u1FCA\u0399", "GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC4".toUpperCase(), "\u0389\u0399", "GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF2".toUpperCase(), "\u1FFA\u0399", "GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF4".toUpperCase(), "\u038F\u0399", "GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI"); + +assert.sameValue("\u1FB7".toUpperCase(), "\u0391\u0342\u0399", "GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FC7".toUpperCase(), "\u0397\u0342\u0399", "GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI"); +assert.sameValue("\u1FF7".toUpperCase(), "\u03A9\u0342\u0399", "GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/supplementary_plane.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/supplementary_plane.js new file mode 100644 index 0000000000..97859bd79e --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/supplementary_plane.js @@ -0,0 +1,65 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: String.prototype.toUpperCase() iterates over code points +info: | + 21.1.3.24 String.prototype.toUpperCase ( ) + + This function behaves in exactly the same way as String.prototype.toLowerCase, + except that code points are mapped to their uppercase equivalents as specified + in the Unicode Character Database. + + 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.24 +---*/ + +assert.sameValue("\uD801\uDC28".toUpperCase(), "\uD801\uDC00", "DESERET SMALL LETTER LONG I"); +assert.sameValue("\uD801\uDC29".toUpperCase(), "\uD801\uDC01", "DESERET SMALL LETTER LONG E"); +assert.sameValue("\uD801\uDC2A".toUpperCase(), "\uD801\uDC02", "DESERET SMALL LETTER LONG A"); +assert.sameValue("\uD801\uDC2B".toUpperCase(), "\uD801\uDC03", "DESERET SMALL LETTER LONG AH"); +assert.sameValue("\uD801\uDC2C".toUpperCase(), "\uD801\uDC04", "DESERET SMALL LETTER LONG O"); +assert.sameValue("\uD801\uDC2D".toUpperCase(), "\uD801\uDC05", "DESERET SMALL LETTER LONG OO"); +assert.sameValue("\uD801\uDC2E".toUpperCase(), "\uD801\uDC06", "DESERET SMALL LETTER SHORT I"); +assert.sameValue("\uD801\uDC2F".toUpperCase(), "\uD801\uDC07", "DESERET SMALL LETTER SHORT E"); +assert.sameValue("\uD801\uDC30".toUpperCase(), "\uD801\uDC08", "DESERET SMALL LETTER SHORT A"); +assert.sameValue("\uD801\uDC31".toUpperCase(), "\uD801\uDC09", "DESERET SMALL LETTER SHORT AH"); +assert.sameValue("\uD801\uDC32".toUpperCase(), "\uD801\uDC0A", "DESERET SMALL LETTER SHORT O"); +assert.sameValue("\uD801\uDC33".toUpperCase(), "\uD801\uDC0B", "DESERET SMALL LETTER SHORT OO"); +assert.sameValue("\uD801\uDC34".toUpperCase(), "\uD801\uDC0C", "DESERET SMALL LETTER AY"); +assert.sameValue("\uD801\uDC35".toUpperCase(), "\uD801\uDC0D", "DESERET SMALL LETTER OW"); +assert.sameValue("\uD801\uDC36".toUpperCase(), "\uD801\uDC0E", "DESERET SMALL LETTER WU"); +assert.sameValue("\uD801\uDC37".toUpperCase(), "\uD801\uDC0F", "DESERET SMALL LETTER YEE"); +assert.sameValue("\uD801\uDC38".toUpperCase(), "\uD801\uDC10", "DESERET SMALL LETTER H"); +assert.sameValue("\uD801\uDC39".toUpperCase(), "\uD801\uDC11", "DESERET SMALL LETTER PEE"); +assert.sameValue("\uD801\uDC3A".toUpperCase(), "\uD801\uDC12", "DESERET SMALL LETTER BEE"); +assert.sameValue("\uD801\uDC3B".toUpperCase(), "\uD801\uDC13", "DESERET SMALL LETTER TEE"); +assert.sameValue("\uD801\uDC3C".toUpperCase(), "\uD801\uDC14", "DESERET SMALL LETTER DEE"); +assert.sameValue("\uD801\uDC3D".toUpperCase(), "\uD801\uDC15", "DESERET SMALL LETTER CHEE"); +assert.sameValue("\uD801\uDC3E".toUpperCase(), "\uD801\uDC16", "DESERET SMALL LETTER JEE"); +assert.sameValue("\uD801\uDC3F".toUpperCase(), "\uD801\uDC17", "DESERET SMALL LETTER KAY"); +assert.sameValue("\uD801\uDC40".toUpperCase(), "\uD801\uDC18", "DESERET SMALL LETTER GAY"); +assert.sameValue("\uD801\uDC41".toUpperCase(), "\uD801\uDC19", "DESERET SMALL LETTER EF"); +assert.sameValue("\uD801\uDC42".toUpperCase(), "\uD801\uDC1A", "DESERET SMALL LETTER VEE"); +assert.sameValue("\uD801\uDC43".toUpperCase(), "\uD801\uDC1B", "DESERET SMALL LETTER ETH"); +assert.sameValue("\uD801\uDC44".toUpperCase(), "\uD801\uDC1C", "DESERET SMALL LETTER THEE"); +assert.sameValue("\uD801\uDC45".toUpperCase(), "\uD801\uDC1D", "DESERET SMALL LETTER ES"); +assert.sameValue("\uD801\uDC46".toUpperCase(), "\uD801\uDC1E", "DESERET SMALL LETTER ZEE"); +assert.sameValue("\uD801\uDC47".toUpperCase(), "\uD801\uDC1F", "DESERET SMALL LETTER ESH"); +assert.sameValue("\uD801\uDC48".toUpperCase(), "\uD801\uDC20", "DESERET SMALL LETTER ZHEE"); +assert.sameValue("\uD801\uDC49".toUpperCase(), "\uD801\uDC21", "DESERET SMALL LETTER ER"); +assert.sameValue("\uD801\uDC4A".toUpperCase(), "\uD801\uDC22", "DESERET SMALL LETTER EL"); +assert.sameValue("\uD801\uDC4B".toUpperCase(), "\uD801\uDC23", "DESERET SMALL LETTER EM"); +assert.sameValue("\uD801\uDC4C".toUpperCase(), "\uD801\uDC24", "DESERET SMALL LETTER EN"); +assert.sameValue("\uD801\uDC4D".toUpperCase(), "\uD801\uDC25", "DESERET SMALL LETTER ENG"); +assert.sameValue("\uD801\uDC4E".toUpperCase(), "\uD801\uDC26", "DESERET SMALL LETTER OI"); +assert.sameValue("\uD801\uDC4F".toUpperCase(), "\uD801\uDC27", "DESERET SMALL LETTER EW"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/toUpperCase/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/this-value-not-obj-coercible.js new file mode 100644 index 0000000000..3114095957 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/toUpperCase/this-value-not-obj-coercible.js @@ -0,0 +1,28 @@ +// 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.touppercase +description: The "this" value must be object-coercible +info: | + This function behaves in exactly the same way as + String.prototype.toLowerCase, except that code points are mapped to their + uppercase equivalents as specified in the Unicode Character Database. + + 21.1.3.24 String.prototype.toLowerCase + + 1. Let O be ? RequireObjectCoercible(this value). +---*/ + +var toUpperCase = String.prototype.toUpperCase; + +assert.sameValue(typeof toUpperCase, 'function'); + +assert.throws(TypeError, function() { + toUpperCase.call(undefined); +}, 'undefined'); + +assert.throws(TypeError, function() { + toUpperCase.call(null); +}, 'null'); + +reportCompare(0, 0); |