diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/concat')
24 files changed, 606 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A10.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A10.js new file mode 100644 index 0000000000..c51f6ecdd1 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A10.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: The String.prototype.concat.length property has the attribute ReadOnly +es5id: 15.5.4.6_A10 +description: > + Checking if varying the String.prototype.concat.length property + fails +includes: [propertyHelper.js] +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.concat.hasOwnProperty('length'))) { + throw new Test262Error('#1: String.prototype.concat.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.concat.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __obj = String.prototype.concat.length; + +verifyNotWritable(String.prototype.concat, "length", null, function() { + return "shifted"; +}); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.concat.length !== __obj) { + throw new Test262Error('#2: __obj = String.prototype.concat.length; String.prototype.concat.length = function(){return "shifted";}; String.prototype.concat.length === __obj. Actual: ' + String.prototype.concat.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A11.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A11.js new file mode 100644 index 0000000000..27347f1f1a --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_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 concat method is 1 +es5id: 15.5.4.6_A11 +description: Checking String.prototype.concat.length +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.concat.hasOwnProperty("length"))) { + throw new Test262Error('#1: String.prototype.concat.hasOwnProperty("length") return true. Actual: ' + String.prototype.concat.hasOwnProperty("length")); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.concat.length !== 1) { + throw new Test262Error('#2: String.prototype.concat.length === 1. Actual: ' + String.prototype.concat.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T1.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T1.js new file mode 100644 index 0000000000..b1d3528276 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_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.concat([,[...]]) +es5id: 15.5.4.6_A1_T1 +description: Arguments are false and true, and instance is object +---*/ + +var __instance = new Object(42); + +__instance.concat = String.prototype.concat; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.concat(false, true) !== "42falsetrue") { + throw new Test262Error('#1: __instance = new Object(42); __instance.concat = String.prototype.concat; __instance.concat(false,true) === "42falsetrue". Actual: ' + __instance.concat(false, true)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T10.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T10.js new file mode 100644 index 0000000000..85b6805c04 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T10.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.concat([,[...]]) +es5id: 15.5.4.6_A1_T10 +description: Call concat([,[...]]) function with object arguments +---*/ + +var __obj = { + toString: function() { + return "\u0041"; + }, + valueOf: function() { + return "_\u0041_"; + } +} +var __obj2 = { + toString: function() { + return true; + } +} +var __obj3 = { + toString: function() { + return 42; + } +} +var __str = "lego"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str.concat(__obj) !== "legoA") { + throw new Test262Error('#1: var x; var __obj = {toString:function(){return "\u0041";}, valueOf:function(){return "_\u0041_";}}; var __str = "lego"; __str.concat(__obj) === "legoA". Actual: ' + __str.concat(__obj)); +} +if (__str.concat(__obj, __obj2, __obj3, x) !== "legoAtrue42undefined") { + throw new Test262Error('#2: var x; var __obj = {toString:function(){return "\u0041";}, valueOf:function(){return "_\u0041_";}}; var __obj2 = {toString:function(){return true;}}; var __obj3 = {toString:function(){return 42;}}; var __str = "lego"; __str.concat(__obj, __obj2, __obj3, x) === "legoAtrue42undefined". Actual: ' + __str.concat(__obj, __obj2, __obj3, x)); +} +// +////////////////////////////////////////////////////////////////////////////// + +var x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T2.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T2.js new file mode 100644 index 0000000000..72c9c7d2df --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.concat([,[...]]) +es5id: 15.5.4.6_A1_T2 +description: > + Arguments are equation with false and true, and instance is + Boolean object +---*/ + +var __instance = new Boolean; + +__instance.concat = String.prototype.concat; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.concat("\u0041", true, true + 1) !== "falseAtrue2") { + throw new Test262Error('#1: __instance = new Boolean; __instance.concat = String.prototype.concat; __instance.concat("\\u0041",true,true+1) === "falseAtrue2". Actual: ' + __instance.concat("\u0041", true, true + 1)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T4.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T4.js new file mode 100644 index 0000000000..cbc64804f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.concat([,[...]]) +es5id: 15.5.4.6_A1_T4 +description: Call concat([,[...]]) function without argument of string object +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString() evaluates to "" concat() evaluates to concat("") +if ("lego".concat() !== "lego") { + throw new Test262Error('#1: "lego".concat() === "lego". Actual: ' + ("lego".concat())); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T5.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T5.js new file mode 100644 index 0000000000..492f6d8772 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T5.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.concat([,[...]]) +es5id: 15.5.4.6_A1_T5 +description: > + Call concat([,[...]]) function with null argument of function + object +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(null) evaluates to "null" concat(null) evaluates to concat("null") +if (function() { + return "lego" + }().concat(null) !== "legonull") { + throw new Test262Error('#1: function(){return "lego"}().concat(null) === "legonull". Actual: ' + function() { + return "lego" + }().concat(null)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T6.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T6.js new file mode 100644 index 0000000000..ab6cc06c17 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T6.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.concat([,[...]]) +es5id: 15.5.4.6_A1_T6 +description: > + Call concat([,[...]]) function with x argument of new String + object, where x is undefined variable +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(undefined) evaluates to "undefined" concat(undefined) evaluates to concat("undefined") +if (new String("lego").concat(x) !== "legoundefined") { + throw new Test262Error('#1: var x; new String("lego").concat(x) === "legoundefined". Actual: ' + new String("lego").concat(x)); +} +// +////////////////////////////////////////////////////////////////////////////// + +var x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T7.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T7.js new file mode 100644 index 0000000000..b3ba0109ad --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T7.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.concat([,[...]]) +es5id: 15.5.4.6_A1_T7 +description: > + Call concat([,[...]]) function with undefined argument of string + object +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(undefined) evaluates to "undefined" concat(undefined) evaluates to concat("undefined") +if (String("lego").concat(undefined) !== "legoundefined") { + throw new Test262Error('#1: String("lego").concat(undefined) === "legoundefined". Actual: ' + String("lego").concat(undefined)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T8.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T8.js new file mode 100644 index 0000000000..7eae3fd440 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T8.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.concat([,[...]]) +es5id: 15.5.4.6_A1_T8 +description: > + Call concat([,[...]]) function with void 0 argument of string + object +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(void 0) evaluates to "undefined" concat(void 0) evaluates to concat("undefined") +if (String(42).concat(void 0) !== "42undefined") { + throw new Test262Error('#1: String(42).concat(void 0) === "42undefined". Actual: ' + String(42).concat(void 0)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T9.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T9.js new file mode 100644 index 0000000000..7a49043e8e --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A1_T9.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.concat([,[...]]) +es5id: 15.5.4.6_A1_T9 +description: > + Call concat([,[...]]) function with function(){}() argument of + string object +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +//since ToString(undefined) evaluates to "undefined" concat(undefined) evaluates to concat("undefined") +if (new String(42).concat(function() {}()) !== "42undefined") { + throw new Test262Error('#1: new String(42).concat(function(){}()) === "42undefined". Actual: ' + new String(42).concat(function() {}())); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A2.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A2.js new file mode 100644 index 0000000000..08f96a9b8c --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A2.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.concat([,[...]]) can accept at least 128 +es5id: 15.5.4.6_A2 +description: Call concat([,[...]]) function with 128 arguments +---*/ + +var __instance = new Number(); + +__instance.concat = String.prototype.concat; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.concat( + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF + ) !== "001234567891011121314150123456789101112131415012345678910111213141501234567891011121314150123456789101112131415012345678910111213141501234567891011121314150123456789101112131415") { + throw new Test262Error('#1: Call concat([,[...]]) function with 128 arguments does not lead to throwing any errors'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A3.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A3.js new file mode 100644 index 0000000000..91034b8756 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A3.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.concat([,[...]]) can't change the instance to be applied +es5id: 15.5.4.6_A3 +description: Checking if varying the instance that is applied fails +---*/ + +var __instance = new String("one"); + +__instance.concat("two"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance != "one") { + throw new Test262Error('#1: __instance = new String("one"); __instance.concat("two"); __instance = new String("one"); __instance.concat("two"); __instance == "one". Actual: ' + __instance); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T1.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T1.js new file mode 100644 index 0000000000..1cbb6fbcb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + when String.prototype.concat([,[...]]) is called first Call ToString, + giving it the this value as its argument +es5id: 15.5.4.6_A4_T1 +description: Override toString function +---*/ + +var __instance = { + toString: function() { + return "one" + } +}; + +__instance.concat = String.prototype.concat; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__instance.concat("two", x) !== "onetwoundefined") { + throw new Test262Error('#1: var x; __instance = {toString:function(){return "one"}}; __instance.concat = String.prototype.concat; __instance.concat("two",x) === "onetwoundefined". Actual: ' + __instance.concat("two", x)); +} +// +////////////////////////////////////////////////////////////////////////////// + +var x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T2.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T2.js new file mode 100644 index 0000000000..3a965d4e5a --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A4_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + when String.prototype.concat([,[...]]) is called first Call ToString, + giving it the this value as its argument +es5id: 15.5.4.6_A4_T2 +description: Override toString function onto function, that throw exception +---*/ + +var __instance = { + toString: function() { + throw "intostring"; + } +}; +var __obj = { + toString: function() { + throw "infirstarg"; + } +}; + +__instance.concat = String.prototype.concat; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + String.prototype.concat.call(__instance, __obj, notexist); + throw new Test262Error('#1: "String.prototype.concat.call(__instance,__obj, notexist)" lead to throwing exception'); +} catch (e) { + if (e !== "intostring") { + throw new Test262Error('#1: e === "intostring". Actual: ' + e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +var notexist; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A6.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A6.js new file mode 100644 index 0000000000..65fa01265f --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_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.concat has not prototype property +es5id: 15.5.4.6_A6 +description: Checking String.prototype.concat.prototype +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (String.prototype.concat.prototype !== undefined) { + throw new Test262Error('#1: String.prototype.concat.prototype === undefined. Actual: ' + String.prototype.concat.prototype); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A7.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A7.js new file mode 100644 index 0000000000..05838ed864 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: String.prototype.concat can't be used as constructor +es5id: 15.5.4.6_A7 +description: Checking if creating the String.prototype.concat object fails +---*/ + +var __FACTORY = String.prototype.concat; + +try { + var __instance = new __FACTORY; + throw new Test262Error('#1: __FACTORY = String.prototype.concat; "__instance = new __FACTORY" lead throwing exception'); +} catch (e) { + if (e instanceof Test262Error) throw e; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A8.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A8.js new file mode 100644 index 0000000000..dee8d4c810 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A8.js @@ -0,0 +1,43 @@ +// 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.concat.length property has the attribute DontEnum +es5id: 15.5.4.6_A8 +description: > + Checking if enumerating the String.prototype.concat.length + property fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.concat.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.concat.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.concat.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (String.prototype.concat.propertyIsEnumerable('length')) { + throw new Test262Error('#1: String.prototype.concat.propertyIsEnumerable(\'length\') return false. Actual: ' + String.prototype.concat.propertyIsEnumerable('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#2 +var count = 0; + +for (var p in String.prototype.concat) { + if (p === "length") count++; +} + +if (count !== 0) { + throw new Test262Error('#2: count = 0; for (p in String.prototype.concat){ if (p==="length") count++;}; count === 0. Actual: ' + count); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A9.js b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_A9.js new file mode 100644 index 0000000000..16a29b87ae --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/S15.5.4.6_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.concat.length property does not have the attribute + DontDelete +es5id: 15.5.4.6_A9 +description: > + Checking if deleting the String.prototype.concat.length property + fails +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(String.prototype.concat.hasOwnProperty('length'))) { + throw new Test262Error('#0: String.prototype.concat.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.concat.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!delete String.prototype.concat.length) { + throw new Test262Error('#1: delete String.prototype.concat.length return true'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (String.prototype.concat.hasOwnProperty('length')) { + throw new Test262Error('#2: delete String.prototype.concat.length; String.prototype.concat.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.concat.hasOwnProperty('length')); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/browser.js b/js/src/tests/test262/built-ins/String/prototype/concat/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/browser.js diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/name.js b/js/src/tests/test262/built-ins/String/prototype/concat/name.js new file mode 100644 index 0000000000..6a4181b098 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/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.4 +description: > + String.prototype.concat.name is "concat". +info: | + String.prototype.concat ( ...args ) + + 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.concat.name, "concat"); + +verifyNotEnumerable(String.prototype.concat, "name"); +verifyNotWritable(String.prototype.concat, "name"); +verifyConfigurable(String.prototype.concat, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/concat/not-a-constructor.js new file mode 100644 index 0000000000..e0287c912b --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/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.concat 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.concat), + false, + 'isConstructor(String.prototype.concat) must return false' +); + +assert.throws(TypeError, () => { + new String.prototype.concat(); +}, '`new String.prototype.concat()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/shell.js b/js/src/tests/test262/built-ins/String/prototype/concat/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/shell.js diff --git a/js/src/tests/test262/built-ins/String/prototype/concat/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/concat/this-value-not-obj-coercible.js new file mode 100644 index 0000000000..eeb652c710 --- /dev/null +++ b/js/src/tests/test262/built-ins/String/prototype/concat/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.concat +description: The "this" value must be object-coercible +info: | + 1. Let O be ? RequireObjectCoercible(this value). +---*/ + +var concat = String.prototype.concat; + +assert.sameValue(typeof concat, 'function'); + +assert.throws(TypeError, function() { + concat.call(undefined, ''); +}, 'undefined'); + +assert.throws(TypeError, function() { + concat.call(null, ''); +}, 'null'); + +reportCompare(0, 0); |