Files
node/test/pummel/test-buffer-large-size-slowbuffer.js
T
Filip Skokan daced4ab98 buffer: move SlowBuffer to EOL
This commits reverts da69d13623

PR-URL: https://github.com/nodejs/node/pull/58220
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-05-09 19:41:31 +00:00

23 lines
534 B
JavaScript

'use strict';
const common = require('../common');
// Buffer with size > INT32_MAX
common.skipIf32Bits();
const assert = require('node:assert');
const { Buffer } = require('node:buffer');
const size = 2 ** 31;
// Test slow Buffer with size larger than integer range
try {
assert.throws(() => Buffer.allocUnsafeSlow(size).toString('utf8'), {
code: 'ERR_STRING_TOO_LONG',
});
} catch (e) {
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
throw e;
}
common.skip('insufficient space for slow Buffer allocation');
}