Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: remove duplicated buffer negative allocation test
  • Loading branch information
ZYSzys committed Feb 22, 2019
commit 283bb601f417c8aa8532d643c9fc0a03ac95131a
17 changes: 0 additions & 17 deletions test/parallel/test-buffer-negative-length.js

This file was deleted.

8 changes: 7 additions & 1 deletion test/parallel/test-buffer-no-negative-allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

const common = require('../common');
const assert = require('assert');
const { SlowBuffer } = require('buffer');

const msg = common.expectsError({
code: 'ERR_INVALID_OPT_VALUE',
type: RangeError,
message: /^The value "[^"]*" is invalid for option "size"$/
}, 16);
}, 20);

// Test that negative Buffer length inputs throw errors.

Expand All @@ -30,3 +31,8 @@ assert.throws(() => Buffer.allocUnsafeSlow(-Buffer.poolSize), msg);
assert.throws(() => Buffer.allocUnsafeSlow(-100), msg);
assert.throws(() => Buffer.allocUnsafeSlow(-1), msg);
assert.throws(() => Buffer.allocUnsafeSlow(NaN), msg);

assert.throws(() => SlowBuffer(-Buffer.poolSize), msg);
assert.throws(() => SlowBuffer(-100), msg);
assert.throws(() => SlowBuffer(-1), msg);
assert.throws(() => SlowBuffer(NaN), msg);