Skip to content

Commit

Permalink
test: remove duplicated buffer negative allocation test
Browse files Browse the repository at this point in the history
PR-URL: #26160
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
  • Loading branch information
ZYSzys authored and BethGriggs committed Apr 16, 2019
1 parent 66ca795 commit 7d6afb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
17 changes: 0 additions & 17 deletions test/parallel/test-buffer-negative-length.js

This file was deleted.

7 changes: 6 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"$/
}, 12);
}, 15);

// Test that negative Buffer length inputs throw errors.

Expand All @@ -26,3 +27,7 @@ assert.throws(() => Buffer.allocUnsafe(-1), msg);
assert.throws(() => Buffer.allocUnsafeSlow(-Buffer.poolSize), msg);
assert.throws(() => Buffer.allocUnsafeSlow(-100), msg);
assert.throws(() => Buffer.allocUnsafeSlow(-1), msg);

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

0 comments on commit 7d6afb3

Please sign in to comment.