This commit is contained in:
David Fugate 2012-01-16 11:17:05 -08:00
parent 9e00383b5f
commit a180d5f371
9 changed files with 65 additions and 105 deletions

View File

@ -33,11 +33,4 @@
<test id="S15.3_A3_T1">Uses this.</test>
<test id="S15.3_A3_T3">Uses this.</test>
<test id="S15.5.4.14_A1_T6">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
<test id="S15.5.4.14_A1_T7">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
<test id="S15.5.4.14_A2_T7">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
<test id="S15.5.4.14_A1_T8">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
<test id="S15.5.4.14_A1_T9">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
<test id="S15.5.4.14_A1_T3">https://bugs.ecmascript.org/show_bug.cgi?id=61</test>
</excludeList>

View File

@ -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) { ; }
var __class__ = toString();
//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);
var __split = split(eval("\"[\""),__obj__lim);
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (typeof __split !== "object") {
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (typeof __split !== "object") {
$ERROR('#1: typeof __split === "object". Actual: '+typeof __split );
}
//
//////////////////////////////////////////////////////////////////////////////
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__split.constructor !== Array) {
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__split.constructor !== Array) {
$ERROR('#2: __split.constructor === Array. Actual: '+__split.constructor );
}
//
//////////////////////////////////////////////////////////////////////////////
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__split.length !== 2) {
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__split.length !== 2) {
$ERROR('#3: __split.length === 2. Actual: '+__split.length );
}
//
//////////////////////////////////////////////////////////////////////////////
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__split[1].substring(0,6) !== "object") {
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__split[1].substring(0,6) !== "object") {
$ERROR('#4: __split[1].substring(0,6) === "object". Actual: '+__split[1].substring(0,6) );
}
//
//////////////////////////////////////////////////////////////////////////////
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -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] );
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -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] );
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -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] );
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -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]);
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -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]);
}
}
//

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"date":"2012-01-13","numTests":11148,"testSuite":["json/ch07.json","json/ch08.json","json/ch09.json","json/ch10.json","json/ch11.json","json/ch12.json","json/ch13.json","json/ch14.json","json/ch15.json"],"version":"ES5.1"}
{"date":"2012-01-16","numTests":11154,"testSuite":["json/ch07.json","json/ch08.json","json/ch09.json","json/ch10.json","json/ch11.json","json/ch12.json","json/ch13.json","json/ch14.json","json/ch15.json"],"version":"ES5.1"}