Adds missing test file for Array.prototype.includes

This commit is contained in:
Ioanna M. Dimitriou H 2024-07-09 20:21:09 +02:00 committed by Philip Chimento
parent 441cbef061
commit 88b013ff7f
1 changed files with 22 additions and 0 deletions

View File

@ -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));
}