aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-no-negative-allocation.js
diff options
context:
space:
mode:
authorZYSzys <17367077526@163.com>2019-02-17 19:28:06 +0800
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-04 02:20:41 +0100
commit6f6f6d4087ed2a60b6a443151dc75c76812a8d80 (patch)
treeb87e146528fcfdc8283e4843a2d9d03b36abfb51 /test/parallel/test-buffer-no-negative-allocation.js
parentdf67cd0fef65f8988e5189769e6e6fc3fb0aa716 (diff)
downloadandroid-node-v8-6f6f6d4087ed2a60b6a443151dc75c76812a8d80.tar.gz
android-node-v8-6f6f6d4087ed2a60b6a443151dc75c76812a8d80.tar.bz2
android-node-v8-6f6f6d4087ed2a60b6a443151dc75c76812a8d80.zip
test: remove duplicated buffer negative allocation test
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test/parallel/test-buffer-no-negative-allocation.js')
-rw-r--r--test/parallel/test-buffer-no-negative-allocation.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/parallel/test-buffer-no-negative-allocation.js b/test/parallel/test-buffer-no-negative-allocation.js
index 3a4958c8f6..d48d02cb9b 100644
--- a/test/parallel/test-buffer-no-negative-allocation.js
+++ b/test/parallel/test-buffer-no-negative-allocation.js
@@ -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.
@@ -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);