mirror of https://github.com/tc39/test262.git
Transform legacy format to harness assertions
This commit is contained in:
parent
08cf542e1b
commit
21e627b35d
|
@ -15,112 +15,80 @@ var obj = {};
|
|||
obj.join = Array.prototype.join;
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#2: obj.length = {valueOf: function() {return 3}, toString: function() {return 2}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#3: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.join() === ",,". Actual: ' + (obj.join()));
|
||||
}
|
||||
|
||||
try {
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",,") {
|
||||
throw new Test262Error('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
|
||||
obj.length = {
|
||||
toString: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.join(), ",,", 'obj.join() must return ",,"');
|
||||
|
||||
obj.length = {
|
||||
toString() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
if (obj.join() !== ",") {
|
||||
throw new Test262Error('#5: obj.length = {toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
if (obj.join() !== ",") {
|
||||
throw new Test262Error('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
|
||||
}
|
||||
assert.sameValue(obj.join(), ",", 'obj.join() must return ","');
|
||||
|
||||
try {
|
||||
assert.throws(Test262Error, () => {
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
throw "error"
|
||||
valueOf() {
|
||||
throw new Test262Error();
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 2
|
||||
}
|
||||
};
|
||||
obj.join();
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (obj.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
obj.join();
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (obj.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8,2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -11,127 +11,134 @@ description: >
|
|||
|
||||
var x = new Array(0, 1, 2, 3);
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0[object Object]1[object Object]2[object Object]3") {
|
||||
throw new Test262Error('#1: var object = {valueOf: function() {return "+"}}; x.join(object) === "0[object Object]1[object Object]2[object Object]3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0[object Object]1[object Object]2[object Object]3",
|
||||
'x.join({valueOf() {return "+"}}) must return "0[object Object]1[object Object]2[object Object]3"'
|
||||
);
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#2: var object = {valueOf: function() {return "+"}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join("{valueOf() {return "+"}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0+1+2+3") {
|
||||
throw new Test262Error('#3: var object = {valueOf: function() {return "+"}, toString: function() {return {}}}; x.join(object) === "0+1+2+3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0+1+2+3",
|
||||
'x.join({valueOf() {return "+"}, toString() {return {}}}) must return "0+1+2+3"'
|
||||
);
|
||||
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join("{valueOf() {throw "error"}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}}; x.join(object) not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
var object = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#5: var object = {toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
assert.sameValue(x.join(object), "0*1*2*3", 'x.join({toString() {return "*"}}) must return "0*1*2*3"');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
}
|
||||
if (x.join(object) !== "0*1*2*3") {
|
||||
throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "*"}}; x.join(object) === "0*1*2*3". Actual: ' + (x.join(object)));
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
x.join(object),
|
||||
"0*1*2*3",
|
||||
'x.join({valueOf() {return {}}, toString() {return "*"}}) must return "0*1*2*3"'
|
||||
);
|
||||
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
x.join(object);
|
||||
throw new Test262Error('#7.1: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}}; x.join(object) throw "error". Actual: ' + (x.join(object)));
|
||||
throw new Test262Error('#7.1: var object = {valueOf() {return "+"}, toString() {throw "error"}}; x.join(object) throw "error". Actual: ' + (x.join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}}; x.join(object) throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
x.join(object);
|
||||
throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x.join(object) throw TypeError. Actual: ' + (x.join(object)));
|
||||
throw new Test262Error('#8.1: var object = {valueOf() {return {}}, toString() {return {}}}; x.join(object) throw TypeError. Actual: ' + (x.join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x.join(object) throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
var object = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
[].join(object);
|
||||
throw new Test262Error('#9.1: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
|
||||
throw new Test262Error('#9.1: var object = {toString() {throw "error"}}; [].join(object) throw "error". Actual: ' + ([].join(object)));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#9.2: var object = {toString: function() {throw "error"}}; [].join(object) throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "[object Object]") {
|
||||
throw new Test262Error('#1: var object = {valueOf: function() {return "+"}} var x = new Array(object); x.join() === "[object Object]". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "[object Object]", 'x.join() must return "[object Object]"');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -26,9 +24,7 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#2: var object = {valueOf: function() {return "+"}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -39,9 +35,7 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "+") {
|
||||
throw new Test262Error('#3: var object = {valueOf: function() {return "+"}, toString: function() {return {}}} var x = new Array(object); x.join() === "+". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "+", 'x.join() must return "+"');
|
||||
|
||||
try {
|
||||
var object = {
|
||||
|
@ -53,16 +47,10 @@ try {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.join() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
var object = {
|
||||
|
@ -71,9 +59,7 @@ var object = {
|
|||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#5: var object = {toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
|
@ -84,9 +70,7 @@ var object = {
|
|||
}
|
||||
}
|
||||
var x = new Array(object);
|
||||
if (x.join() !== "*") {
|
||||
throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return "*"}} var x = new Array(object); x.join() === "*". Actual: ' + (x.join()));
|
||||
}
|
||||
assert.sameValue(x.join(), "*", 'x.join() must return "*"');
|
||||
|
||||
try {
|
||||
var object = {
|
||||
|
@ -102,9 +86,7 @@ try {
|
|||
throw new Test262Error('#7.1: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.join() throw "error". Actual: ' + (x.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.join() throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -121,7 +103,9 @@ try {
|
|||
throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.join() throw TypeError. Actual: ' + (x.join()));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.join();
|
||||
throw new Test262Error('#1.1: new Array.prototype.join() throw TypeError. Actual: ' + (new Array.prototype.join()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.join() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -16,125 +16,109 @@ obj.pop = Array.prototype.pop;
|
|||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#1: obj[0] = -1; obj.length = {valueOf: function() {return 1}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#0: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return 0}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return {}}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
throw new Test262Error('#4.1: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() === ",". Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, -1, 'The value of pop is expected to be -1');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#5: obj[0] = -1; obj.length = {toString: function() {return 0}} obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, undefined, 'The value of pop is expected to equal undefined');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
throw new Test262Error('#6: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return 0}} obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
assert.sameValue(pop, undefined, 'The value of pop is expected to equal undefined');
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (pop));
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf() {throw "error"}, toString() {return 0}}; obj.pop() throw "error". Actual: ' + (pop));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var pop = obj.pop();
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (pop));
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf() {return {}}, toString() {return {}}} obj.pop() throw TypeError. Actual: ' + (pop));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.pop();
|
||||
throw new Test262Error('#1.1: new Array.prototype.pop() throw TypeError. Actual: ' + (new Array.prototype.pop()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.pop() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -15,121 +15,104 @@ var obj = {};
|
|||
obj.push = Array.prototype.push;
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
if (push !== 3) {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}} obj.push() === 3. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 3, 'The value of push is expected to be 3');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
if (push !== 3) {
|
||||
throw new Test262Error('#0: obj.length = {valueOf: function() {return 3}, toString: function() {return 1}} obj.push() === 3. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 3, 'The value of push is expected to be 3');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
if (push !== 3) {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.push() === 3. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 3, 'The value of push is expected to be 3');
|
||||
|
||||
try {
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
if (push !== 3) {
|
||||
throw new Test262Error('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.push() === ",". Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 3, 'The value of push is expected to be 3');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.push() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.push() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
obj.length = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
if (push !== 1) {
|
||||
throw new Test262Error('#5: obj.length = {toString: function() {return 1}} obj.push() === 1. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 1, 'The value of push is expected to be 1');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
var push = obj.push();
|
||||
if (push !== 1) {
|
||||
throw new Test262Error('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 1}} obj.push() === 1. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 1, 'The value of push is expected to be 1');
|
||||
|
||||
try {
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.push() throw "error". Actual: ' + (push));
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf() {throw "error"}, toString() {return 1}}; obj.push() throw "error". Actual: ' + (push));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.push() throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var push = obj.push();
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.push() throw TypeError. Actual: ' + (push));
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf() {return {}}, toString() {return {}}} obj.push() throw TypeError. Actual: ' + (push));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.push() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,23 +11,18 @@ var x = [];
|
|||
x.length = 4294967295;
|
||||
|
||||
var push = x.push();
|
||||
if (push !== 4294967295) {
|
||||
throw new Test262Error('#1: x = []; x.length = 4294967295; x.push() === 4294967295. Actual: ' + (push));
|
||||
}
|
||||
assert.sameValue(push, 4294967295, 'The value of push is expected to be 4294967295');
|
||||
|
||||
try {
|
||||
x.push("x");
|
||||
throw new Test262Error('#2.1: x = []; x.length = 4294967295; x.push("x") throw RangeError. Actual: ' + (push));
|
||||
} catch (e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
throw new Test262Error('#2.2: x = []; x.length = 4294967295; x.push("x") throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof RangeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof RangeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
||||
if (x[4294967295] !== "x") {
|
||||
throw new Test262Error('#3: x = []; x.length = 4294967295; try {x.push("x")}catch(e){}; x[4294967295] === "x". Actual: ' + (x[4294967295]));
|
||||
}
|
||||
|
||||
if (x.length !== 4294967295) {
|
||||
throw new Test262Error('#4: x = []; x.length = 4294967295; try {x.push("x")}catch(e){}; x.length === 4294967295. Actual: ' + (x.length));
|
||||
}
|
||||
assert.sameValue(x[4294967295], "x", 'The value of x[4294967295] is expected to be "x"');
|
||||
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.push();
|
||||
throw new Test262Error('#1.1: new Array.prototype.push() throw TypeError. Actual: ' + (new Array.prototype.push()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.push() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.reverse();
|
||||
throw new Test262Error('#1.1: new Array.prototype.reverse() throw TypeError. Actual: ' + (new Array.prototype.reverse()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.reverse() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -16,125 +16,109 @@ obj.shift = Array.prototype.shift;
|
|||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
throw new Test262Error('#1: obj[0] = -1; obj.length = {valueOf: function() {return 1}} obj.shift() === -1. Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, -1, 'The value of shift is expected to be -1');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
throw new Test262Error('#0: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return 0}} obj.shift() === -1. Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, -1, 'The value of shift is expected to be -1');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
throw new Test262Error('#3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return {}}} obj.shift() === -1. Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, -1, 'The value of shift is expected to be -1');
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 1
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
throw new Test262Error('#4.1: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.shift() === ",". Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, -1, 'The value of shift is expected to be -1');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.shift() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.shift() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
throw new Test262Error('#5: obj[0] = -1; obj.length = {toString: function() {return 0}} obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, undefined, 'The value of shift is expected to equal undefined');
|
||||
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
throw new Test262Error('#6: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return 0}} obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
assert.sameValue(shift, undefined, 'The value of shift is expected to equal undefined');
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 0
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.shift() throw "error". Actual: ' + (shift));
|
||||
throw new Test262Error('#7.1: obj[0] = -1; obj.length = {valueOf() {throw "error"}, toString() {return 0}}; obj.shift() throw "error". Actual: ' + (shift));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.shift() throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var shift = obj.shift();
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.shift() throw TypeError. Actual: ' + (shift));
|
||||
throw new Test262Error('#8.1: obj[0] = -1; obj.length = {valueOf() {return {}}, toString() {return {}}} obj.shift() throw TypeError. Actual: ' + (shift));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.shift() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.shift();
|
||||
throw new Test262Error('#1.1: new Array.prototype.shift() throw TypeError. Actual: ' + (new Array.prototype.shift()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.shift() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -7,17 +7,13 @@ esid: sec-array.prototype.slice
|
|||
description: length = 4294967296
|
||||
---*/
|
||||
|
||||
var obj = {};
|
||||
obj.slice = Array.prototype.slice;
|
||||
obj[0] = "x";
|
||||
obj[4294967295] = "y";
|
||||
obj.length = 4294967296;
|
||||
|
||||
try {
|
||||
var arr = obj.slice(0, 4294967296);
|
||||
throw new Test262Error('#1: var obj = {}; obj.slice = Array.prototype.slice; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; var arr = obj.slice(0,4294967296); lead to throwing exception.');
|
||||
} catch (e) {
|
||||
if (!(e instanceof RangeError)) {
|
||||
throw new Test262Error('#1.1: var obj = {}; obj.slice = Array.prototype.slice; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; var arr = obj.slice(0,4294967296); lead to throwing exception. Exception is instance of RangeError. Actual: exception is ' + e);
|
||||
}
|
||||
}
|
||||
assert.throws(RangeError, () => {
|
||||
var obj = {};
|
||||
obj.slice = Array.prototype.slice;
|
||||
obj[0] = "x";
|
||||
obj[4294967295] = "y";
|
||||
obj.length = 4294967296;
|
||||
obj.slice(0, 4294967296);
|
||||
new Array.prototype.toLocaleString();
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -7,17 +7,12 @@ esid: sec-array.prototype.slice
|
|||
description: length = 4294967297
|
||||
---*/
|
||||
|
||||
var obj = {};
|
||||
obj.slice = Array.prototype.slice;
|
||||
obj[0] = "x";
|
||||
obj[4294967296] = "y";
|
||||
obj.length = 4294967297;
|
||||
|
||||
try {
|
||||
var arr = obj.slice(0, 4294967297);
|
||||
throw new Test262Error('#1: var obj = {}; obj.slice = Array.prototype.slice; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; var arr = obj.slice(0,4294967297); lead to throwing exception.');
|
||||
} catch (e) {
|
||||
if (!(e instanceof RangeError)) {
|
||||
throw new Test262Error('#1.1: var obj = {}; obj.slice = Array.prototype.slice; obj[0] = "x"; obj[4294967296] = "y"; obj.length = 4294967297; var arr = obj.slice(0,4294967297); lead to throwing exception. Exception is instance of RangeError. Actual: exception is ' + e);
|
||||
}
|
||||
}
|
||||
assert.throws(RangeError, () => {
|
||||
var obj = {};
|
||||
obj.slice = Array.prototype.slice;
|
||||
obj[0] = "x";
|
||||
obj[4294967296] = "y";
|
||||
obj.length = 4294967297;
|
||||
obj.slice(0, 4294967297);
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.slice();
|
||||
throw new Test262Error('#1.1: new Array.prototype.slice() throw TypeError. Actual: ' + (new Array.prototype.slice()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.slice() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -7,15 +7,10 @@ esid: sec-array.prototype.sort
|
|||
description: comparefn function throw "error"
|
||||
---*/
|
||||
|
||||
var myComparefn = function(x, y) {
|
||||
throw "error";
|
||||
}
|
||||
var x = [1, 0];
|
||||
try {
|
||||
x.sort(myComparefn)
|
||||
throw new Test262Error('#1.1: Array.sort should not eat exceptions');
|
||||
} catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#1.2: Array.sort should not eat exceptions');
|
||||
assert.throws(Test262Error, () => {
|
||||
var myComparefn = function(x, y) {
|
||||
throw new Test262Error();
|
||||
}
|
||||
}
|
||||
var x = [1, 0];
|
||||
x.sort(myComparefn);
|
||||
});
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.sort();
|
||||
throw new Test262Error('#1.1: new Array.prototype.sort() throw TypeError. Actual: ' + (new Array.prototype.sort()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.sort() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.splice();
|
||||
throw new Test262Error('#1.1: new Array.prototype.splice() throw TypeError. Actual: ' + (new Array.prototype.splice()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.splice() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -10,12 +10,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.toLocaleString();
|
||||
throw new Test262Error('#1.1: new Array.prototype.toLocaleString() throw TypeError. Actual: ' + (new Array.prototype.toLocaleString()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.toLocaleString() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -11,144 +11,89 @@ description: If Type(value) is Object, evaluate ToPrimitive(value, String)
|
|||
---*/
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#1.1: var object = {valueOf: function() {return "+"}} var x = new Array(object); x.toString() === x.join(). Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "[object Object]") {
|
||||
throw new Test262Error('#1.2: var object = {valueOf: function() {return "+"}} var x = new Array(object); x.toString() === "[object Object]". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#2.1: var object = {valueOf: function() {return "+"}, toString: function() {return x.join()}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "*") {
|
||||
throw new Test262Error('#2.2: var object = {valueOf: function() {return "+"}, toString: function() {return "*"}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#3.1: var object = {valueOf: function() {return x.join()}, toString: function() {return {}}} var x = new Array(object); x.toString() === "+". Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "+") {
|
||||
throw new Test262Error('#3.2: var object = {valueOf: function() {return "+"}, toString: function() {return {}}} var x = new Array(object); x.toString() === "+". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return x.join()}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "*") {
|
||||
throw new Test262Error('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.toString() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.4: var object = {valueOf: function() {throw "error"}, toString: function() {return "*"}} var x = new Array(object); x.toString() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
var object = {
|
||||
toString: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#5.1: var object = {toString: function() {return x.join()}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "*") {
|
||||
throw new Test262Error('#5.2: var object = {toString: function() {return "*"}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
var object = {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return "*"
|
||||
}
|
||||
}
|
||||
var x = new Array(object);
|
||||
if (x.toString() !== x.join()) {
|
||||
throw new Test262Error('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return x.join()}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
} else {
|
||||
if (x.toString() !== "*") {
|
||||
throw new Test262Error('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return "*"}} var x = new Array(object); x.toString() === "*". Actual: ' + (x.toString()));
|
||||
}
|
||||
}
|
||||
assert.sameValue(x.toString(), x.join(), 'x.toString() must return the same value returned by x.join()');
|
||||
|
||||
try {
|
||||
assert.throws(Test262Error, () => {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return "+"
|
||||
},
|
||||
toString: function() {
|
||||
throw "error"
|
||||
toString() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
x.toString();
|
||||
throw new Test262Error('#7.1: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.toString() throw "error". Actual: ' + (x.toString()));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: var object = {valueOf: function() {return "+"}, toString: function() {throw "error"}} var x = new Array(object); x.toString() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
var object = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var x = new Array(object);
|
||||
x.toString();
|
||||
throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.toString() throw TypeError. Actual: ' + (x.toString()));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}} var x = new Array(object); x.toString() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -10,12 +10,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.toString();
|
||||
throw new Test262Error('#1.1: new Array.prototype.toString() throw TypeError. Actual: ' + (new Array.prototype.toString()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.toString() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
|
@ -15,120 +15,104 @@ var obj = {};
|
|||
obj.unshift = Array.prototype.unshift;
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 3) {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}} obj.unshift() === 3. Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 3, 'The value of unshift is expected to be 3');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 3) {
|
||||
throw new Test262Error('#0: obj.length = {valueOf: function() {return 3}, toString: function() {return 1}} obj.unshift() === 3. Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 3, 'The value of unshift is expected to be 3');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 3) {
|
||||
throw new Test262Error('#1: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.unshift() === 3. Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 3, 'The value of unshift is expected to be 3');
|
||||
|
||||
try {
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return 3
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
throw "error"
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 3) {
|
||||
throw new Test262Error('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.unshift() === ",". Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 3, 'The value of unshift is expected to be 3');
|
||||
}
|
||||
catch (e) {
|
||||
if (e === "error") {
|
||||
throw new Test262Error('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.unshift() not throw "error"');
|
||||
} else {
|
||||
throw new Test262Error('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.unshift() not throw Error. Actual: ' + (e));
|
||||
}
|
||||
assert.notSameValue(e, "error", 'The value of e is not "error"');
|
||||
}
|
||||
|
||||
obj.length = {
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 1) {
|
||||
throw new Test262Error('#5: obj.length = {toString: function() {return 1}} obj.unshift() === 1. Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 1, 'The value of unshift is expected to be 1');
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
var unshift = obj.unshift();
|
||||
if (unshift !== 1) {
|
||||
throw new Test262Error('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 1}} obj.unshift() === 1. Actual: ' + (unshift));
|
||||
}
|
||||
assert.sameValue(unshift, 1, 'The value of unshift is expected to be 1');
|
||||
|
||||
try {
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
throw "error"
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return 1
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.unshift() throw "error". Actual: ' + (unshift));
|
||||
throw new Test262Error('#7.1: obj.length = {valueOf() {throw "error"}, toString() {return 1}}; obj.unshift() throw "error". Actual: ' + (unshift));
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
throw new Test262Error('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.unshift() throw "error". Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
obj.length = {
|
||||
valueOf: function() {
|
||||
valueOf() {
|
||||
return {}
|
||||
},
|
||||
toString: function() {
|
||||
toString() {
|
||||
return {}
|
||||
}
|
||||
};
|
||||
var unshift = obj.unshift();
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.unshift() throw TypeError. Actual: ' + (unshift));
|
||||
throw new Test262Error('#8.1: obj.length = {valueOf() {return {}}, toString() {return {}}} obj.unshift() throw TypeError. Actual: ' + (unshift));
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#8.2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.unshift() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
assert.sameValue(
|
||||
e instanceof TypeError,
|
||||
true,
|
||||
'The result of evaluating (e instanceof TypeError) is expected to be true'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,7 @@ description: >
|
|||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, () => {
|
||||
new Array.prototype.unshift();
|
||||
throw new Test262Error('#1.1: new Array.prototype.unshift() throw TypeError. Actual: ' + (new Array.prototype.unshift()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
throw new Test262Error('#1.2: new Array.prototype.unshift() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
throw new Test262Error();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue