Skip to content

Commit

Permalink
Adds missing test file for Array.prototype.includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannad committed Jul 9, 2024
1 parent d24849b commit cc1b5c2
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-%array%.prototype.includes
description: >
Array.p.includes behaves correctly for special float values on float
TypedArrays backed by resizable buffers.
includes: [resizableArrayBufferUtils.js]
features: [resizable-arraybuffer, Array.prototype.includes]
---*/

for (let ctor of floatCtors) {
const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT);
const lengthTracking = new ctor(rab);
lengthTracking[0] = -Infinity;
lengthTracking[1] = Infinity;
lengthTracking[2] = NaN;
assert(Array.prototype.includes.call(lengthTracking, -Infinity));
assert(Array.prototype.includes.call(lengthTracking, Infinity));
assert(Array.prototype.includes.call(lengthTracking, NaN));
}

0 comments on commit cc1b5c2

Please sign in to comment.