Remove duplication of buffer tests, separate out into separate files, update and cleanup code, move to using strictEqual where possible. PR-URL: https://github.com/nodejs/node/pull/8256 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Conflicts: test/parallel/test-buffer-alloc.js test/parallel/test-buffer.js test/parallel/test-buffer-no-negative-allocation.js
13 lines
507 B
JavaScript
13 lines
507 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const SlowBuffer = require('buffer').SlowBuffer;
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/649.
|
|
const len = 1422561062959;
|
|
assert.throws(() => Buffer(len).toString('utf8'));
|
|
assert.throws(() => SlowBuffer(len).toString('utf8'));
|
|
assert.throws(() => Buffer.alloc(len).toString('utf8'));
|
|
assert.throws(() => Buffer.allocUnsafe(len).toString('utf8'));
|
|
assert.throws(() => Buffer.allocUnsafeSlow(len).toString('utf8'));
|