chore: migrate $ERROR -> throw new Test262Error in tools/lint/test/fixtures/harness/propertyHelper.js (#3124)

This commit is contained in:
Rick Waldron 2021-07-29 15:34:53 -04:00 committed by GitHub
parent 8afbeda683
commit 304edd2296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,7 +106,7 @@ function isConfigurable(obj, name) {
delete obj[name];
} catch (e) {
if (!(e instanceof TypeError)) {
$ERROR("Expected TypeError, got " + e);
throw new Test262Error("Expected TypeError, got " + e);
}
}
return !hasOwnProperty.call(obj, name);
@ -149,7 +149,7 @@ function isWritable(obj, name, verifyProp, value) {
obj[name] = newValue;
} catch (e) {
if (!(e instanceof TypeError)) {
$ERROR("Expected TypeError, got " + e);
throw new Test262Error("Expected TypeError, got " + e);
}
}
@ -171,7 +171,7 @@ function isWritable(obj, name, verifyProp, value) {
function verifyEqualTo(obj, name, value) {
if (!isSameValue(obj[name], value)) {
$ERROR("Expected obj[" + String(name) + "] to equal " + value +
throw new Test262Error("Expected obj[" + String(name) + "] to equal " + value +
", actually " + obj[name]);
}
}
@ -182,7 +182,7 @@ function verifyWritable(obj, name, verifyProp, value) {
"Expected obj[" + String(name) + "] to have writable:true.");
}
if (!isWritable(obj, name, verifyProp, value)) {
$ERROR("Expected obj[" + String(name) + "] to be writable, but was not.");
throw new Test262Error("Expected obj[" + String(name) + "] to be writable, but was not.");
}
}
@ -192,7 +192,7 @@ function verifyNotWritable(obj, name, verifyProp, value) {
"Expected obj[" + String(name) + "] to have writable:false.");
}
if (isWritable(obj, name, verifyProp)) {
$ERROR("Expected obj[" + String(name) + "] NOT to be writable, but was.");
throw new Test262Error("Expected obj[" + String(name) + "] NOT to be writable, but was.");
}
}
@ -200,7 +200,7 @@ function verifyEnumerable(obj, name) {
assert(Object.getOwnPropertyDescriptor(obj, name).enumerable,
"Expected obj[" + String(name) + "] to have enumerable:true.");
if (!isEnumerable(obj, name)) {
$ERROR("Expected obj[" + String(name) + "] to be enumerable, but was not.");
throw new Test262Error("Expected obj[" + String(name) + "] to be enumerable, but was not.");
}
}
@ -208,7 +208,7 @@ function verifyNotEnumerable(obj, name) {
assert(!Object.getOwnPropertyDescriptor(obj, name).enumerable,
"Expected obj[" + String(name) + "] to have enumerable:false.");
if (isEnumerable(obj, name)) {
$ERROR("Expected obj[" + String(name) + "] NOT to be enumerable, but was.");
throw new Test262Error("Expected obj[" + String(name) + "] NOT to be enumerable, but was.");
}
}
@ -216,7 +216,7 @@ function verifyConfigurable(obj, name) {
assert(Object.getOwnPropertyDescriptor(obj, name).configurable,
"Expected obj[" + String(name) + "] to have configurable:true.");
if (!isConfigurable(obj, name)) {
$ERROR("Expected obj[" + String(name) + "] to be configurable, but was not.");
throw new Test262Error("Expected obj[" + String(name) + "] to be configurable, but was not.");
}
}
@ -224,6 +224,6 @@ function verifyNotConfigurable(obj, name) {
assert(!Object.getOwnPropertyDescriptor(obj, name).configurable,
"Expected obj[" + String(name) + "] to have configurable:false.");
if (isConfigurable(obj, name)) {
$ERROR("Expected obj[" + String(name) + "] NOT to be configurable, but was.");
throw new Test262Error("Expected obj[" + String(name) + "] NOT to be configurable, but was.");
}
}