Skip to content

Commit

Permalink
Fix test for Safari 13
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Oct 30, 2021
1 parent 9d22316 commit c43754d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/Float16Array.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ describe("Float16Array", () => {

it("define properties", function () {
// Safari 13 bug
const float32 = new Float32Array(1);
Object.defineProperty(float32, 0, { value: 1 });
if (float32[0] !== 1) {
try {
const float32 = new Float32Array(1);
Object.defineProperty(float32, 0, { value: 1 });
} catch (e) {
this.skip();
}

const float16 = new Float16Array(5);

Object.defineProperty(float16, 0, { value: 1.337 });
Expand Down Expand Up @@ -183,9 +183,15 @@ describe("Float16Array", () => {
}
});

it("can't be frozen with elements", () => {
it("can't be frozen with elements", function () {
// Safari 13 bug
try {
Object.freeze(new Proxy({ foo: 1 }, { defineProperty() { return false; } }));
this.skip();
} catch (e) {/* empty */}

assert.doesNotThrow(() => Object.freeze(new Float16Array()));
assert.throws(() => Object.freeze(new Float16Array(10)), TypeError);
assert.throws(() => Object.freeze(new Float16Array(4)), TypeError);
});

it("can't change property & prototype property if it frozen", function () {
Expand Down

0 comments on commit c43754d

Please sign in to comment.