aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-07-16 15:19:01 -0600
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:17 -0700
commit60a974d200b8eeab2a92e0a68a8b2a98899f8e6d (patch)
treefb4c123e7b7f1ae8eb22411eb910e167a4018c37 /test
parent2ba8b236612c1cc9ea69dd82508c981c8a3937e0 (diff)
downloadandroid-node-v8-60a974d200b8eeab2a92e0a68a8b2a98899f8e6d.tar.gz
android-node-v8-60a974d200b8eeab2a92e0a68a8b2a98899f8e6d.tar.bz2
android-node-v8-60a974d200b8eeab2a92e0a68a8b2a98899f8e6d.zip
buffer: fix missing null/undefined check
The new implementation of Buffer missed the check for null/undefined as the first argument to new Buffer(). Reintroduce the check and add test. Fix: e8734c0 "buffer: implement Uint8Array backed Buffer" Fix: https://github.com/nodejs/io.js/issues/2194 PR-URL: https://github.com/nodejs/io.js/pull/2195 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-buffer.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js
index 3daa02eac7..d5013c3552 100644
--- a/test/parallel/test-buffer.js
+++ b/test/parallel/test-buffer.js
@@ -1181,3 +1181,11 @@ Buffer.poolSize = ps;
assert.throws(function() {
Buffer(10).copy();
});
+
+assert.throws(function() {
+ new Buffer();
+}, /must start with number, buffer, array or string/);
+
+assert.throws(function() {
+ new Buffer(null);
+}, /must start with number, buffer, array or string/);