From a180d5f37193a8630f4edcb20e019c96405666c3 Mon Sep 17 00:00:00 2001 From: David Fugate Date: Mon, 16 Jan 2012 11:17:05 -0800 Subject: https://bugs.ecmascript.org/show_bug.cgi?id=61 is fixed. --- test/config/excludelist.xml | 7 -- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T3.js | 81 +++++++++++----------- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T6.js | 16 ++--- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T7.js | 18 ++--- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T8.js | 18 ++--- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T9.js | 18 ++--- .../ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A2_T7.js | 8 +-- 7 files changed, 63 insertions(+), 103 deletions(-) (limited to 'test') diff --git a/test/config/excludelist.xml b/test/config/excludelist.xml index 10eb937aa..f00ede4de 100644 --- a/test/config/excludelist.xml +++ b/test/config/excludelist.xml @@ -32,12 +32,5 @@ Uses this. Uses this. - - https://bugs.ecmascript.org/show_bug.cgi?id=61 - https://bugs.ecmascript.org/show_bug.cgi?id=61 - https://bugs.ecmascript.org/show_bug.cgi?id=61 - https://bugs.ecmascript.org/show_bug.cgi?id=61 - https://bugs.ecmascript.org/show_bug.cgi?id=61 - https://bugs.ecmascript.org/show_bug.cgi?id=61 diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T3.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T3.js index a2fc8db36..715a562cd 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T3.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T3.js @@ -12,47 +12,50 @@ * @description Checking by using eval */ -var split = String.prototype.split; +var split = String.prototype.split.bind(this); var __obj__lim = {valueOf:function(){return 5;}}; -if (typeof toString === "undefined"){ +try { toString = Object.prototype.toString; +} catch(e) { ; } + +//Checks are only valid if we can overwrite the global object's toString method +//(which ES5 doesn't even require to exist) +if (toString===Object.prototype.toString) { + var __class__ = toString(); + + var __split = split(eval("\"[\""),__obj__lim); + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (typeof __split !== "object") { + $ERROR('#1: typeof __split === "object". Actual: '+typeof __split ); + } + // + ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#2 + if (__split.constructor !== Array) { + $ERROR('#2: __split.constructor === Array. Actual: '+__split.constructor ); + } + // + ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#3 + if (__split.length !== 2) { + $ERROR('#3: __split.length === 2. Actual: '+__split.length ); + } + // + ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#3 + if (__split[1].substring(0,6) !== "object") { + $ERROR('#4: __split[1].substring(0,6) === "object". Actual: '+__split[1].substring(0,6) ); + } + // + ////////////////////////////////////////////////////////////////////////////// } - -var __class__ = toString(); - -var __split = split(eval("\"[\""),__obj__lim); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __split !== "object") { - $ERROR('#1: typeof __split === "object". Actual: '+typeof __split ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__split.constructor !== Array) { - $ERROR('#2: __split.constructor === Array. Actual: '+__split.constructor ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (__split.length !== 2) { - $ERROR('#3: __split.length === 2. Actual: '+__split.length ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (__split[1].substring(0,6) !== "object") { - $ERROR('#4: __split[1].substring(0,6) === "object". Actual: '+__split[1].substring(0,6) ); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T6.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T6.js index 6fc4e3736..7d3fcceb0 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T6.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T6.js @@ -33,24 +33,16 @@ if (__split.constructor !== Array) { ////////////////////////////////////////////////////////////////////////////// //CHECK#3 -if (__split.length !== 2) { - $ERROR('#3: var x; __split = new String("1undefined").split(x); __split.length === 2. Actual: '+__split.length ); +if (__split.length !== 1) { + $ERROR('#3: var x; __split = new String("1undefined").split(x); __split.length === 1. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#4 -if (__split[0] !== "1") { - $ERROR('#4: var x; __split = new String("1undefined").split(x); __split[0] === "1". Actual: '+__split[0] ); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#5 -if (__split[1] !== "") { - $ERROR('#5: var x; __split = new String("1undefined").split(x); __split[1] === "". Actual: '+__split[1] ); +if (__split[0] !== "1undefined") { + $ERROR('#4: var x; __split = new String("1undefined").split(x); __split[0] === "1undefined". Actual: '+__split[0] ); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T7.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T7.js index 6c31b83a4..bf48c7656 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T7.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T7.js @@ -12,7 +12,6 @@ * @description Argument is undefined, and instance is String */ -//since ToString(undefined) evaluates to "undefined" split(undefined) evaluates to split("undefined",0) var __split = String("undefinedd").split(undefined); ////////////////////////////////////////////////////////////////////////////// @@ -33,25 +32,16 @@ if (__split.constructor !== Array) { ////////////////////////////////////////////////////////////////////////////// //CHECK#3 -if (__split.length !== 2) { - $ERROR('#3: __split = String("undefinedd").split(undefined); __split.length === 2. Actual: '+__split.length ); +if (__split.length !== 1) { + $ERROR('#3: __split = String("undefinedd").split(undefined); __split.length === 1. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#4 -if (__split[0] !== "") { - $ERROR('#4: __split = String("undefinedd").split(undefined); __split[0] === "". Actual: '+__split[0] ); +if (__split[0] !== "undefinedd") { + $ERROR('#4: __split = String("undefinedd").split(undefined); __split[0] === "undefinedd". Actual: '+__split[0] ); } // ////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#5 -if (__split[1] !== "d") { - $ERROR('#5: __split = String("undefinedd").split(undefined); __split[1] === "d". Actual: '+__split[1] ); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T8.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T8.js index de8f71717..2feaba65b 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T8.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T8.js @@ -14,7 +14,6 @@ var __obj = {toString:function(){}}; -//since ToString(void 0) evaluates to "undefined" split(void 0) evaluates to split("undefined") var __split = String(__obj).split(void 0); ////////////////////////////////////////////////////////////////////////////// @@ -35,25 +34,16 @@ if (__split.constructor !== Array) { ////////////////////////////////////////////////////////////////////////////// //CHECK#3 -if (__split.length !== 2) { - $ERROR('#3: __obj = {toString:function(){}}; __split = String(__obj).split(void 0); __split.length === 2. Actual: '+__split.length ); +if (__split.length !== 1) { + $ERROR('#3: __obj = {toString:function(){}}; __split = String(__obj).split(void 0); __split.length === 1. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#4 -if (__split[0] !== "") { - $ERROR('#4: __obj = {toString:function(){}}; __split = String(__obj).split(void 0); __split[0] !== "". Actual: '+__split[0]); +if (__split[0] !== "undefined") { + $ERROR('#4: __obj = {toString:function(){}}; __split = String(__obj).split(void 0); __split[0] !== "undefined". Actual: '+__split[0]); } // ////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#5 -if (__split[1] !== "") { - $ERROR('#5: __obj = {toString:function(){}}; __split = String(__obj).split(void 0); __split[1] === "". Actual: '+__split[1] ); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T9.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T9.js index e1a28ff83..b50272419 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T9.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A1_T9.js @@ -17,7 +17,7 @@ var __obj = { toString:void 0 }; -//since ToString(undefined) evaluates to "undefined" split(undefined) evaluates to split("undefined") +//since ToString(undefined) evaluates to "undefined" var __split = new String(__obj).split(function(){}()); ////////////////////////////////////////////////////////////////////////////// @@ -38,24 +38,16 @@ if (__split.constructor !== Array) { ////////////////////////////////////////////////////////////////////////////// //CHECK#3 -if (__split.length !== 2) { - $ERROR('#3: __obj = {valueOf:function(){}, toString:void 0}; __split = new String(__obj).split(function(){}()); __split.length === 2. Actual: '+__split.length ); +if (__split.length !== 1) { + $ERROR('#3: __obj = {valueOf:function(){}, toString:void 0}; __split = new String(__obj).split(function(){}()); __split.length === 1. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#4 -if (__split[0] !== "") { - $ERROR('#4: __obj = {valueOf:function(){}, toString:void 0}; __split = new String(__obj).split(function(){}()); __split[0] !== "". Actual: '+__split[0]); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#5 -if (__split[1] !== "") { - $ERROR('#5: __obj = {valueOf:function(){}, toString:void 0}; __split = new String(__obj).split(function(){}()); __split[1] === "". Actual: '+__split[1] ); +if (__split[0] !== "undefined") { + $ERROR('#4: __obj = {valueOf:function(){}, toString:void 0}; __split = new String(__obj).split(function(){}()); __split[0] !== "undefined". Actual: '+__split[0]); } // ////////////////////////////////////////////////////////////////////////////// diff --git a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A2_T7.js b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A2_T7.js index cf20b6f5e..45b645767 100644 --- a/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A2_T7.js +++ b/test/suite/ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A2_T7.js @@ -12,14 +12,14 @@ */ var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; -var __expected = ["this", "is", "a", "string", "object"]; +var __expected = [__string]; var __split = __string.split(void 0); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__split.constructor !== Array) { - $ERROR('#1: var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["this", "is", "a", "string", "object"]; __split = __string.split(void 0); __split.constructor === Array. Actual: '+__split.constructor ); + $ERROR('#1: var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["thisundefinedisundefinedaundefinedstringundefinedobject"]; __split = __string.split(void 0); __split.constructor === Array. Actual: '+__split.constructor ); } // ////////////////////////////////////////////////////////////////////////////// @@ -27,7 +27,7 @@ if (__split.constructor !== Array) { ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (__split.length !== __expected.length) { - $ERROR('#2: var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["this", "is", "a", "string", "object"]; __split = __string.split(void 0); __split.length === __expected.length. Actual: '+__split.length ); + $ERROR('#2: var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["thisundefinedisundefinedaundefinedstringundefinedobject"]; __split = __string.split(void 0); __split.length === __expected.length. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ if (__split.length !== __expected.length) { //CHECK#3 for ( var i = 0; i < __expected.length; i++ ) { if (__expected[i]!==__split[i]) { - $ERROR('#3.'+i+': var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["this", "is", "a", "string", "object"]; __split = __string.split(void 0); __expected['+i+']==='+__split[i]+'. Actual: '+__expected[i]); + $ERROR('#3.'+i+': var __string = "thisundefinedisundefinedaundefinedstringundefinedobject"; var __expected = ["thisundefinedisundefinedaundefinedstringundefinedobject"]; __split = __string.split(void 0); __expected['+i+']==='+__split[i]+'. Actual: '+__expected[i]); } } // -- cgit v1.2.3