Skip to content

Commit

Permalink
use proper isConstructor check for recently added ArrayBuffer/SharedA…
Browse files Browse the repository at this point in the history
…rrayBuffer tests
  • Loading branch information
ljharb authored and Ms2ger committed Aug 25, 2023
1 parent 9efb4f8 commit f03d9ba
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
8 changes: 3 additions & 5 deletions test/built-ins/ArrayBuffer/prototype/resize/nonconstructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
features: [resizable-arraybuffer]
includes: [isConstructor.js]
features: [resizable-arraybuffer, Reflect.construct]
---*/

assert.sameValue(
Object.prototype.hasOwnProperty.call(ArrayBuffer.prototype.resize, 'prototype'),
false
);
assert(!isConstructor(ArrayBuffer.prototype.resize), "ArrayBuffer.prototype.resize is not a constructor");

var arrayBuffer = new ArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down
4 changes: 3 additions & 1 deletion test/built-ins/ArrayBuffer/prototype/slice/nonconstructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/

assert.sameValue(Object.prototype.hasOwnProperty.call(ArrayBuffer.prototype.slice, "prototype"), false);
assert(!isConstructor(ArrayBuffer.prototype.slice), "ArrayBuffer.prototype.slice is not a constructor");

var arrayBuffer = new ArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
features: [arraybuffer-transfer]
includes: [isConstructor.js]
features: [arraybuffer-transfer, Reflect.construct]
---*/

assert.sameValue(
Object.prototype.hasOwnProperty.call(ArrayBuffer.prototype.transfer, 'prototype'),
false
);
assert(!isConstructor(ArrayBuffer.prototype.transfer), "ArrayBuffer.prototype.transfer is not a constructor");

var arrayBuffer = new ArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
features: [arraybuffer-transfer]
includes: [isConstructor.js]
features: [arraybuffer-transfer, Reflect.construct]
---*/

assert.sameValue(
Object.prototype.hasOwnProperty.call(ArrayBuffer.prototype.transferToFixedLength, 'prototype'),
false
);
assert(!isConstructor(ArrayBuffer.prototype.transferToFixedLength), "ArrayBuffer.prototype.transferToFixedLength is not a constructor");

var arrayBuffer = new ArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
features: [SharedArrayBuffer, resizable-arraybuffer]
includes: [isConstructor.js]
features: [SharedArrayBuffer, resizable-arraybuffer, Reflect.construct]
---*/

assert.sameValue(
Object.prototype.hasOwnProperty.call(SharedArrayBuffer.prototype.grow, 'prototype'),
false
);
assert(!isConstructor(SharedArrayBuffer.prototype.grow), "SharedArrayBuffer.prototype.grow is not a constructor");

var arrayBuffer = new SharedArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ info: |
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified
in the description of a particular function.
features: [SharedArrayBuffer]
includes: [isConstructor.js]
features: [SharedArrayBuffer, Reflect.construct]
---*/

assert.sameValue(Object.prototype.hasOwnProperty.call(SharedArrayBuffer.prototype.slice, "prototype"), false);
assert(!isConstructor(SharedArrayBuffer.prototype.slice), "SharedArrayBuffer.prototype.slice is not a constructor");

var arrayBuffer = new SharedArrayBuffer(8);
assert.throws(TypeError, function() {
Expand Down

0 comments on commit f03d9ba

Please sign in to comment.