summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-alloc.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-04-16 03:42:22 -0400
committerJames M Snell <jasnell@gmail.com>2017-04-18 08:47:11 -0700
commit7cd0d4f644e304d4c8239dca532ca4de50d981ba (patch)
treeed741fed3834c4ec941841538c6999bbc9f9f351 /test/parallel/test-buffer-alloc.js
parent2519757b800a21c6b93490372841bc58307c46b7 (diff)
downloadandroid-node-v8-7cd0d4f644e304d4c8239dca532ca4de50d981ba.tar.gz
android-node-v8-7cd0d4f644e304d4c8239dca532ca4de50d981ba.tar.bz2
android-node-v8-7cd0d4f644e304d4c8239dca532ca4de50d981ba.zip
buffer: fix backwards incompatibility
4a86803f6 introduced a backwards incompatibility by accident and was not caught due to an existing test that wasn't strict enough. This commit fixes both the backwards incompatibility and the test. PR-URL: https://github.com/nodejs/node/pull/12439 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-alloc.js')
-rw-r--r--test/parallel/test-buffer-alloc.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js
index 02ed1bcf63..7b868f783e 100644
--- a/test/parallel/test-buffer-alloc.js
+++ b/test/parallel/test-buffer-alloc.js
@@ -885,7 +885,8 @@ assert.throws(() => Buffer.allocUnsafe(8).writeFloatLE(0.0, -1), RangeError);
}
// Regression test for #5482: should throw but not assert in C++ land.
-assert.throws(() => Buffer.from('', 'buffer'), TypeError);
+assert.throws(() => Buffer.from('', 'buffer'),
+ /^TypeError: "encoding" must be a valid string encoding$/);
// Regression test for #6111. Constructing a buffer from another buffer
// should a) work, and b) not corrupt the source buffer.