mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
22 lines
664 B
TypeScript
22 lines
664 B
TypeScript
import { expect, test } from "bun:test";
|
|
|
|
test("Buffer.concat throws OutOfMemoryError", () => {
|
|
const bufferToUse = Buffer.allocUnsafe(1024 * 1024 * 64);
|
|
const buffers = new Array(1024);
|
|
for (let i = 0; i < buffers.length; i++) {
|
|
buffers[i] = bufferToUse;
|
|
}
|
|
|
|
expect(() => Buffer.concat(buffers)).toThrow(/out of memory/i);
|
|
});
|
|
|
|
test("Bun.concatArrayBuffers throws OutOfMemoryError", () => {
|
|
const bufferToUse = Buffer.allocUnsafe(1024 * 1024 * 64);
|
|
const buffers = new Array(1024);
|
|
for (let i = 0; i < buffers.length; i++) {
|
|
buffers[i] = bufferToUse;
|
|
}
|
|
|
|
expect(() => Bun.concatArrayBuffers(buffers)).toThrow(/Failed to allocate/i);
|
|
});
|