chore: migrate $ERROR -> throw new Test262Error in test/built-ins/Error (#3081)

This commit is contained in:
Rick Waldron 2021-07-21 17:26:19 -04:00 committed by GitHub
parent 2c3300312e
commit f37edcb486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 28 additions and 28 deletions

View File

@ -14,7 +14,7 @@ var proto = Error.prototype;
verifyNotConfigurable(Error, "prototype"); verifyNotConfigurable(Error, "prototype");
try { try {
if ((delete Error.prototype) !== false) { 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) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) throw e;
@ -26,7 +26,7 @@ try {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#2 //CHECK#2
if (Error.prototype !== proto) { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,7 @@ description: Checking if enumerating the Error.prototype property fails
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#0 //CHECK#0
if (!(Error.hasOwnProperty('prototype'))) { 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 // CHECK#1
if (Error.propertyIsEnumerable('prototype')) { 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) { if (cout !== 0) {
$ERROR('#2: cout === 0. Actual: ' + cout); throw new Test262Error('#2: cout === 0. Actual: ' + cout);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (!(Error.hasOwnProperty('prototype'))) { 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 //CHECK#2
if (Error.prototype !== __obj) { 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 //CHECK#3
try { try {
Error.prototype(); Error.prototype();
$ERROR('#3: "Error.prototype()" lead to throwing exception'); throw new Test262Error('#3: "Error.prototype()" lead to throwing exception');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) throw e;
} }

View File

@ -10,7 +10,7 @@ description: Checking Error.hasOwnProperty('prototype')
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (!(Error.hasOwnProperty('prototype'))) { 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'));
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -12,7 +12,7 @@ description: Get Error.prototype and compare with Object.prototype
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (!Object.prototype.isPrototypeOf(Error.prototype)) { 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));
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -17,7 +17,7 @@ var __tostr = Error.prototype.toString();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (__tostr !== "[object Object]") { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -11,7 +11,7 @@ description: Checking if call of Error prototype as a function fails
//CHECK#1 //CHECK#1
try { try {
Error.prototype(); Error.prototype();
$ERROR('#1: "Error.prototype()" lead to throwing exception'); throw new Test262Error('#1: "Error.prototype()" lead to throwing exception');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) throw e;
} }

View File

@ -11,7 +11,7 @@ description: Checking if creating "new Error.prototype" fails
//CHECK#1 //CHECK#1
try { try {
var __instance = new Error.prototype; 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) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) throw e;
} }

View File

@ -12,7 +12,7 @@ description: Checking Error.prototype.constructor
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//CHECK#1 //CHECK#1
if (Error.prototype.constructor !== Error) { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -18,7 +18,7 @@ var err = new constr;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#0 // CHECK#0
if (err === undefined) { 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 // CHECK#1
if (err.constructor !== Error) { 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 // CHECK#2
if (!(Error.prototype.isPrototypeOf(err))) { 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; Error.prototype.toString = Object.prototype.toString;
var to_string_result = '[object ' + 'Error' + ']'; var to_string_result = '[object ' + 'Error' + ']';
if (err.toString() !== to_string_result) { 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 // CHECK#4
if (err.valueOf().toString() !== to_string_result) { 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());
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,7 @@ description: Checking Error.prototype.message
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (!Error.prototype.hasOwnProperty('message')) { 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'));
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,7 @@ description: Checking value of Error.prototype.message
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (typeof Error.prototype.message !== "string") { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,7 @@ description: Checking Error.prototype.name
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (!Error.prototype.hasOwnProperty('name')) { 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'));
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,7 @@ description: Checking value of Error.prototype.name
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (Error.prototype.name !== "Error") { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -11,8 +11,8 @@ description: >
var errObj = new Error(); var errObj = new Error();
errObj.name = ""; errObj.name = "";
if (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() !== "") { if (errObj.toString() !== "") {
$ERROR("Expected errObj.toString() to be '', actually " + errObj.toString()); throw new Test262Error("Expected errObj.toString() to be '', actually " + errObj.toString());
} }

View File

@ -10,7 +10,7 @@ description: Checking Error.prototype.toString
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// CHECK#1 // CHECK#1
if (!Error.prototype.hasOwnProperty('toString')) { 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'));
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -14,10 +14,10 @@ try {
var toStr = err1.toString(); var toStr = err1.toString();
} }
catch (e) { 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) { 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);
} }
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////