Migrate test/harness/* away from dependence on $ERROR(). Close gh-742

This commit is contained in:
Rick Waldron 2020-09-16 13:57:40 -04:00
parent e662428fb4
commit c5e8aa9ca2
38 changed files with 81 additions and 81 deletions

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -15,10 +15,10 @@ try {
} catch (err) { } catch (err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.'); throw new Error('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.');
} }
} }
if (!threw) { if (!threw) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -15,10 +15,10 @@ try {
} catch (err) { } catch (err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.'); throw new Error('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.');
} }
} }
if (!threw) { if (!threw) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -22,5 +22,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -16,7 +16,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -24,5 +24,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,5 +21,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -13,7 +13,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -21,7 +21,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }
threw = false; threw = false;
@ -31,7 +31,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -39,7 +39,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }
threw = false; threw = false;
@ -49,7 +49,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -57,5 +57,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -15,7 +15,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -23,5 +23,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -14,7 +14,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -22,5 +22,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -12,7 +12,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -20,5 +20,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -15,10 +15,10 @@ try {
} catch (err) { } catch (err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.'); throw new Error('Expected a Test262Error, but a "' + err.constructor.name + '" was thrown.');
} }
} }
if (!threw) { if (!threw) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -26,9 +26,9 @@ try {
thrown = err; thrown = err;
} }
if (!thrown) { if (!thrown) {
$ERROR('Expected error, but no error was thrown.'); throw new Error('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) { } else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.'); throw new Error('Expected error of type Test262Error.');
} }
thrown = null; thrown = null;
@ -38,9 +38,9 @@ try {
thrown = err; thrown = err;
} }
if (!thrown) { if (!thrown) {
$ERROR('Expected error, but no error was thrown.'); throw new Error('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) { } else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.'); throw new Error('Expected error of type Test262Error.');
} }
thrown = null; thrown = null;
@ -50,9 +50,9 @@ try {
thrown = err; thrown = err;
} }
if (!thrown) { if (!thrown) {
$ERROR('Expected error, but no error was thrown.'); throw new Error('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) { } else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.'); throw new Error('Expected error of type Test262Error.');
} }
thrown = null; thrown = null;
@ -62,9 +62,9 @@ try {
thrown = err; thrown = err;
} }
if (!thrown) { if (!thrown) {
$ERROR('Expected error, but no error was thrown.'); throw new Error('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) { } else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.'); throw new Error('Expected error of type Test262Error.');
} }
thrown = null; thrown = null;
@ -74,7 +74,7 @@ try {
thrown = err; thrown = err;
} }
if (!thrown) { if (!thrown) {
$ERROR('Expected error, but no error was thrown.'); throw new Error('Expected error, but no error was thrown.');
} else if (thrown.constructor !== Test262Error) { } else if (thrown.constructor !== Test262Error) {
$ERROR('Expected error of type Test262Error.'); throw new Error('Expected error of type Test262Error.');
} }

View File

@ -11,5 +11,5 @@ var first = [0, 'a', undefined];
var second = [0, 'b', undefined]; var second = [0, 'b', undefined];
if (compareArray(first, second) !== false) { if (compareArray(first, second) !== false) {
$ERROR('Arrays containing different elements are not equivalent.'); throw new Error('Arrays containing different elements are not equivalent.');
} }

View File

@ -8,9 +8,9 @@ includes: [compareArray.js]
---*/ ---*/
if (compareArray([], [undefined]) !== false) { if (compareArray([], [undefined]) !== false) {
$ERROR('Arrays of differing lengths are not equivalent.'); throw new Error('Arrays of differing lengths are not equivalent.');
} }
if (compareArray([undefined], []) !== false) { if (compareArray([undefined], []) !== false) {
$ERROR('Arrays of differing lengths are not equivalent.'); throw new Error('Arrays of differing lengths are not equivalent.');
} }

View File

@ -8,5 +8,5 @@ includes: [compareArray.js]
---*/ ---*/
if (compareArray([], []) !== true) { if (compareArray([], []) !== true) {
$ERROR('Empty arrays are equivalent.'); throw new Error('Empty arrays are equivalent.');
} }

View File

@ -12,5 +12,5 @@ var first = [0, 1, '', 's', null, undefined, obj];
var second = [0, 1, '', 's', undefined, null, obj]; var second = [0, 1, '', 's', undefined, null, obj];
if (compareArray(first, second) !== false) { if (compareArray(first, second) !== false) {
$ERROR('Arrays containing the same elements in different order are not equivalent.'); throw new Error('Arrays containing the same elements in different order are not equivalent.');
} }

View File

@ -12,5 +12,5 @@ var first = [0, 1, '', 's', undefined, null, obj];
var second = [0, 1, '', 's', undefined, null, obj]; var second = [0, 1, '', 's', undefined, null, obj];
if (compareArray(first, second) !== true) { if (compareArray(first, second) !== true) {
$ERROR('Arrays containing the same elements in the same order are equivalent.'); throw new Error('Arrays containing the same elements in the same order are equivalent.');
} }

View File

@ -8,21 +8,21 @@ includes: [compareArray.js]
---*/ ---*/
if (compareArray([,], [,]) !== true) { if (compareArray([,], [,]) !== true) {
$ERROR('Sparse arrays of the same length are equivalent.'); throw new Error('Sparse arrays of the same length are equivalent.');
} }
if (compareArray([,], [,,]) !== false) { if (compareArray([,], [,,]) !== false) {
$ERROR('Sparse arrays of differing lengths are not equivalent.'); throw new Error('Sparse arrays of differing lengths are not equivalent.');
} }
if (compareArray([,,], [,]) !== false) { if (compareArray([,,], [,]) !== false) {
$ERROR('Sparse arrays of differing lengths are not equivalent.'); throw new Error('Sparse arrays of differing lengths are not equivalent.');
} }
if (compareArray([,], []) !== false) { if (compareArray([,], []) !== false) {
$ERROR('Sparse arrays are not equivalent to empty arrays.'); throw new Error('Sparse arrays are not equivalent to empty arrays.');
} }
if (compareArray([], [,]) !== false) { if (compareArray([], [,]) !== false) {
$ERROR('Sparse arrays are not equivalent to empty arrays.'); throw new Error('Sparse arrays are not equivalent to empty arrays.');
} }

View File

@ -26,18 +26,18 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
} }
if (err.message !== '$262.detachArrayBuffer called.') { if (err.message !== '$262.detachArrayBuffer called.') {
$ERROR(`Expected error message: ${err.message}`); throw new Error(`Expected error message: ${err.message}`);
} }
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -19,7 +19,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== ReferenceError) { if (err.constructor !== ReferenceError) {
$ERROR( throw new Error(
'Expected a ReferenceError, but a "' + err.constructor.name + 'Expected a ReferenceError, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -27,7 +27,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a ReferenceError, but no error was thrown.'); throw new Error('Expected a ReferenceError, but no error was thrown.');
} }

View File

@ -31,7 +31,7 @@ includes: [nativeFunctionMatcher.js]
try { try {
validateNativeFunctionSource(s); validateNativeFunctionSource(s);
} catch (unused) { } catch (unused) {
$ERROR(`${JSON.stringify(s)} should pass`); throw new Error(`${JSON.stringify(s)} should pass`);
} }
}); });
@ -55,6 +55,6 @@ includes: [nativeFunctionMatcher.js]
fail = true; fail = true;
} catch (unused) {} } catch (unused) {}
if (fail) { if (fail) {
$ERROR(`${JSON.stringify(s)} should fail`); throw new Error(`${JSON.stringify(s)} should fail`);
} }
}); });

View File

@ -22,7 +22,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -30,6 +30,6 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -19,7 +19,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -27,5 +27,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -28,5 +28,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -26,5 +26,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -18,7 +18,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -26,5 +26,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -18,7 +18,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );

View File

@ -17,5 +17,5 @@ Object.defineProperty(obj, 'a', {
verifyNotWritable(obj, 'a'); verifyNotWritable(obj, 'a');
if (obj.a !== 123) { if (obj.a !== 123) {
$ERROR('`verifyNotWritable` should be non-destructive.'); throw new Error('`verifyNotWritable` should be non-destructive.');
} }

View File

@ -18,7 +18,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -26,5 +26,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -18,7 +18,7 @@ try {
} catch(err) { } catch(err) {
threw = true; threw = true;
if (err.constructor !== Test262Error) { if (err.constructor !== Test262Error) {
$ERROR( throw new Error(
'Expected a Test262Error, but a "' + err.constructor.name + 'Expected a Test262Error, but a "' + err.constructor.name +
'" was thrown.' '" was thrown.'
); );
@ -26,5 +26,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -16,5 +16,5 @@ Object.defineProperty(obj, 'a', {
verifyWritable(obj, 'a'); verifyWritable(obj, 'a');
if (obj.a !== 123) { if (obj.a !== 123) {
$ERROR('`verifyWritable` should be non-destructive.'); throw new Error('`verifyWritable` should be non-destructive.');
} }

View File

@ -24,5 +24,5 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }

View File

@ -24,7 +24,7 @@ try {
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a TypeError, but no error was thrown.'); throw new Error('Expected a TypeError, but no error was thrown.');
} }

View File

@ -30,10 +30,10 @@ try {
} }
if (err.message !== 'descriptor value should be 2') { if (err.message !== 'descriptor value should be 2') {
$ERROR('The error thrown did not define the specified message.'); throw new Error('The error thrown did not define the specified message.');
} }
} }
if (threw === false) { if (threw === false) {
$ERROR('Expected a Test262Error, but no error was thrown.'); throw new Error('Expected a Test262Error, but no error was thrown.');
} }