Update tests to use APIs defined by included files

The `$DETACHBUFFER` function is the preferred mechanism for detaching
array buffers.

Likewise, `verifyNotWritable` is the preferred mechanism for asserting
lack of writability.
This commit is contained in:
Mike Pennisi 2019-09-24 20:17:53 -04:00
parent f26c2a11bd
commit 1e4e524251
6 changed files with 6 additions and 8 deletions

View File

@ -18,7 +18,7 @@ testWithTypedArrayConstructors(TA => {
var i = 0;
assert.throws(TypeError, () => {
for (let key of typedArray.keys()) {
$262.detachArrayBuffer(typedArray.buffer);
$DETACHBUFFER(typedArray.buffer);
i++;
}
});

View File

@ -18,9 +18,7 @@ Object.defineProperties(obj, {
}
});
if (isWritable(obj, "prop")) {
$ERROR('Expected obj["prop"] not to be writable.');
}
verifyNotWritable(obj, "prop");
if (!obj.hasOwnProperty("prop")) {
$ERROR('Expected obj.hasOwnProperty("prop") to be true, actually ' + obj.hasOwnProperty("prop"));

View File

@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
{
value: {
valueOf: function() {
$262.detachArrayBuffer(ta.buffer);
$DETACHBUFFER(ta.buffer);
return 42n;
}
}

View File

@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) {
{
value: {
valueOf: function() {
$262.detachArrayBuffer(ta.buffer);
$DETACHBUFFER(ta.buffer);
return 42;
}
}

View File

@ -32,7 +32,7 @@ testWithBigIntTypedArrayConstructors(function(TA) {
assert.throws(TypeError, function() {
Reflect.set(ta, 0, {
valueOf: function() {
$262.detachArrayBuffer(ta.buffer);
$DETACHBUFFER(ta.buffer);
return 42n;
}
});

View File

@ -32,7 +32,7 @@ testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, function() {
Reflect.set(ta, 0, {
valueOf: function() {
$262.detachArrayBuffer(ta.buffer);
$DETACHBUFFER(ta.buffer);
return 42;
}
});