mirror of https://github.com/tc39/test262.git
chore: migrate $ERROR -> throw new Test262Error in test/built-ins/Error (#3081)
This commit is contained in:
parent
2c3300312e
commit
f37edcb486
|
@ -14,7 +14,7 @@ var proto = Error.prototype;
|
|||
verifyNotConfigurable(Error, "prototype");
|
||||
try {
|
||||
if ((delete Error.prototype) !== false) {
|
||||
$ERROR('#1: Error.prototype has the attribute DontDelete');
|
||||
throw new Test262Error('#1: Error.prototype has the attribute DontDelete');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof Test262Error) throw e;
|
||||
|
@ -26,7 +26,7 @@ try {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
if (Error.prototype !== proto) {
|
||||
$ERROR('#2: var proto=Error.prototype; delete Error.prototype; Error.prototype===proto. Actual: ' + Error.prototype);
|
||||
throw new Test262Error('#2: var proto=Error.prototype; delete Error.prototype; Error.prototype===proto. Actual: ' + Error.prototype);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking if enumerating the Error.prototype property fails
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#0
|
||||
if (!(Error.hasOwnProperty('prototype'))) {
|
||||
$ERROR('#0: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
throw new Test262Error('#0: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -19,7 +19,7 @@ if (!(Error.hasOwnProperty('prototype'))) {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (Error.propertyIsEnumerable('prototype')) {
|
||||
$ERROR('#1: Error.propertyIsEnumerable(\'prototype\') return false. Actual: ' + Error.propertyIsEnumerable('prototype'));
|
||||
throw new Test262Error('#1: Error.propertyIsEnumerable(\'prototype\') return false. Actual: ' + Error.propertyIsEnumerable('prototype'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -34,7 +34,7 @@ for (var p in Error) {
|
|||
}
|
||||
|
||||
if (cout !== 0) {
|
||||
$ERROR('#2: cout === 0. Actual: ' + cout);
|
||||
throw new Test262Error('#2: cout === 0. Actual: ' + cout);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (!(Error.hasOwnProperty('prototype'))) {
|
||||
$ERROR('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
throw new Test262Error('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -25,7 +25,7 @@ verifyNotWritable(Error, "prototype", null, function() {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
if (Error.prototype !== __obj) {
|
||||
$ERROR('#2: __obj = Error.prototype; Error.prototype = function(){return "shifted";}; Error.prototype === __obj. Actual: ' + Error.prototype);
|
||||
throw new Test262Error('#2: __obj = Error.prototype; Error.prototype = function(){return "shifted";}; Error.prototype === __obj. Actual: ' + Error.prototype);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -34,7 +34,7 @@ if (Error.prototype !== __obj) {
|
|||
//CHECK#3
|
||||
try {
|
||||
Error.prototype();
|
||||
$ERROR('#3: "Error.prototype()" lead to throwing exception');
|
||||
throw new Test262Error('#3: "Error.prototype()" lead to throwing exception');
|
||||
} catch (e) {
|
||||
if (e instanceof Test262Error) throw e;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking Error.hasOwnProperty('prototype')
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (!(Error.hasOwnProperty('prototype'))) {
|
||||
$ERROR('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
throw new Test262Error('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: ' + Error.hasOwnProperty('prototype'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Get Error.prototype and compare with Object.prototype
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (!Object.prototype.isPrototypeOf(Error.prototype)) {
|
||||
$ERROR('#1: Object.prototype.isPrototypeOf(Error.prototype) return true. Actual: ' + Object.prototype.isPrototypeOf(Error.prototype));
|
||||
throw new Test262Error('#1: Object.prototype.isPrototypeOf(Error.prototype) return true. Actual: ' + Object.prototype.isPrototypeOf(Error.prototype));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -17,7 +17,7 @@ var __tostr = Error.prototype.toString();
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (__tostr !== "[object Object]") {
|
||||
$ERROR('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Object]". Actual: ' + __tostr);
|
||||
throw new Test262Error('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Object]". Actual: ' + __tostr);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -11,7 +11,7 @@ description: Checking if call of Error prototype as a function fails
|
|||
//CHECK#1
|
||||
try {
|
||||
Error.prototype();
|
||||
$ERROR('#1: "Error.prototype()" lead to throwing exception');
|
||||
throw new Test262Error('#1: "Error.prototype()" lead to throwing exception');
|
||||
} catch (e) {
|
||||
if (e instanceof Test262Error) throw e;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ description: Checking if creating "new Error.prototype" fails
|
|||
//CHECK#1
|
||||
try {
|
||||
var __instance = new Error.prototype;
|
||||
$ERROR('#1: "var __instance = new Error.prototype" lead to throwing exception');
|
||||
throw new Test262Error('#1: "var __instance = new Error.prototype" lead to throwing exception');
|
||||
} catch (e) {
|
||||
if (e instanceof Test262Error) throw e;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: Checking Error.prototype.constructor
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (Error.prototype.constructor !== Error) {
|
||||
$ERROR('#1: Error.prototype.constructor === Error. Actual: ' + Error.prototype.constructor);
|
||||
throw new Test262Error('#1: Error.prototype.constructor === Error. Actual: ' + Error.prototype.constructor);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -18,7 +18,7 @@ var err = new constr;
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#0
|
||||
if (err === undefined) {
|
||||
$ERROR('#0: constr = Error.prototype.constructor; err = new constr; err === undefined');
|
||||
throw new Test262Error('#0: constr = Error.prototype.constructor; err = new constr; err === undefined');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,7 +26,7 @@ if (err === undefined) {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (err.constructor !== Error) {
|
||||
$ERROR('#1: constr = Error.prototype.constructor; err = new constr; err.constructor === Error. Actual: ' + err.constructor);
|
||||
throw new Test262Error('#1: constr = Error.prototype.constructor; err = new constr; err.constructor === Error. Actual: ' + err.constructor);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -34,7 +34,7 @@ if (err.constructor !== Error) {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#2
|
||||
if (!(Error.prototype.isPrototypeOf(err))) {
|
||||
$ERROR('#2: constr = Error.prototype.constructor; err = new constr; Error.prototype.isPrototypeOf(err) return true. Actual: ' + Error.prototype.isPrototypeOf(err));
|
||||
throw new Test262Error('#2: constr = Error.prototype.constructor; err = new constr; Error.prototype.isPrototypeOf(err) return true. Actual: ' + Error.prototype.isPrototypeOf(err));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -44,7 +44,7 @@ if (!(Error.prototype.isPrototypeOf(err))) {
|
|||
Error.prototype.toString = Object.prototype.toString;
|
||||
var to_string_result = '[object ' + 'Error' + ']';
|
||||
if (err.toString() !== to_string_result) {
|
||||
$ERROR('#3: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.toString() === \'[object Error]\'. Actual: ' + err.toString());
|
||||
throw new Test262Error('#3: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.toString() === \'[object Error]\'. Actual: ' + err.toString());
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -52,7 +52,7 @@ if (err.toString() !== to_string_result) {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#4
|
||||
if (err.valueOf().toString() !== to_string_result) {
|
||||
$ERROR('#4: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.valueOf().toString() === \'[object Error]\'. Actual: ' + err.valueOf().toString());
|
||||
throw new Test262Error('#4: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.valueOf().toString() === \'[object Error]\'. Actual: ' + err.valueOf().toString());
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking Error.prototype.message
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (!Error.prototype.hasOwnProperty('message')) {
|
||||
$ERROR('#1: Error.prototype.hasOwnProperty(\'message\') reurn true. Actual: ' + Error.prototype.hasOwnProperty('message'));
|
||||
throw new Test262Error('#1: Error.prototype.hasOwnProperty(\'message\') reurn true. Actual: ' + Error.prototype.hasOwnProperty('message'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking value of Error.prototype.message
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (typeof Error.prototype.message !== "string") {
|
||||
$ERROR('#1: typeof Error.prototype.message === "string". Actual: ' + Error.prototype.message);
|
||||
throw new Test262Error('#1: typeof Error.prototype.message === "string". Actual: ' + Error.prototype.message);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking Error.prototype.name
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (!Error.prototype.hasOwnProperty('name')) {
|
||||
$ERROR('#1: Error.prototype.hasOwnProperty(\'name\') return true. Actual: ' + Error.prototype.hasOwnProperty('name'));
|
||||
throw new Test262Error('#1: Error.prototype.hasOwnProperty(\'name\') return true. Actual: ' + Error.prototype.hasOwnProperty('name'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking value of Error.prototype.name
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (Error.prototype.name !== "Error") {
|
||||
$ERROR('#1: Error.prototype.name==="Error". Actual: ' + Error.prototype.name);
|
||||
throw new Test262Error('#1: Error.prototype.name==="Error". Actual: ' + Error.prototype.name);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -11,8 +11,8 @@ description: >
|
|||
var errObj = new Error();
|
||||
errObj.name = "";
|
||||
if (errObj.name !== "") {
|
||||
$ERROR("Expected errObj.name to be '', actually " + errObj.name);
|
||||
throw new Test262Error("Expected errObj.name to be '', actually " + errObj.name);
|
||||
}
|
||||
if (errObj.toString() !== "") {
|
||||
$ERROR("Expected errObj.toString() to be '', actually " + errObj.toString());
|
||||
throw new Test262Error("Expected errObj.toString() to be '', actually " + errObj.toString());
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ description: Checking Error.prototype.toString
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// CHECK#1
|
||||
if (!Error.prototype.hasOwnProperty('toString')) {
|
||||
$ERROR('#1: Error.prototype.hasOwnProperty(\'toString\') return true. Actual: ' + Error.prototype.hasOwnProperty('toString'));
|
||||
throw new Test262Error('#1: Error.prototype.hasOwnProperty(\'toString\') return true. Actual: ' + Error.prototype.hasOwnProperty('toString'));
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -14,10 +14,10 @@ try {
|
|||
var toStr = err1.toString();
|
||||
}
|
||||
catch (e) {
|
||||
$ERROR('#1: var err1=new Error("Error"); var toStr=err1.toString(); lead to throwing exception. Exception is ' + e);
|
||||
throw new Test262Error('#1: var err1=new Error("Error"); var toStr=err1.toString(); lead to throwing exception. Exception is ' + e);
|
||||
}
|
||||
if (toStr === undefined) {
|
||||
$ERROR('#2: var err1=new Error("Error"); var toStr=err1.toString(); toStr!==undefined. Actual: ' + toStr);
|
||||
throw new Test262Error('#2: var err1=new Error("Error"); var toStr=err1.toString(); toStr!==undefined. Actual: ' + toStr);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue