Avoid false positive (#2375)

Prior to this patch, the modified test would pass if no exception was
produced. Use the `assert.throws` utility function to concisely express
the expectation more completely.
This commit is contained in:
jugglinmike 2019-09-27 16:25:07 -04:00 committed by Leo Balter
parent 83483b7310
commit 479ea0ec0b
1 changed files with 5 additions and 11 deletions

View File

@ -23,17 +23,11 @@ Object.defineProperty(arrObj, "1", {
configurable: true
});
try {
assert.throws(TypeError, function() {
arrObj[1] = 4;
} catch (e) {
verifyEqualTo(arrObj, "1", getFunc());
});
verifyEqualTo(arrObj, "1", getFunc());
verifyNotEnumerable(arrObj, "1");
verifyNotEnumerable(arrObj, "1");
verifyConfigurable(arrObj, "1");
if (!(e instanceof TypeError)) {
$ERROR("Expected TypeError, got " + e);
}
}
verifyConfigurable(arrObj, "1");