summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-arraybuffer.js
diff options
context:
space:
mode:
authorP.S.V.R <pmq2001@gmail.com>2015-11-16 10:59:07 +0800
committerTrevor Norris <trev.norris@gmail.com>2015-11-16 21:27:21 -0700
commit0ed3a7c11b4031bdb56908b16f2aa5aea24c1813 (patch)
tree7fbe17197edd1ca2b272840057aa9b9a33c40a3b /test/parallel/test-buffer-arraybuffer.js
parentdf268f97bc567e1182753d3d06b481d4abda20e8 (diff)
downloadandroid-node-v8-0ed3a7c11b4031bdb56908b16f2aa5aea24c1813.tar.gz
android-node-v8-0ed3a7c11b4031bdb56908b16f2aa5aea24c1813.tar.bz2
android-node-v8-0ed3a7c11b4031bdb56908b16f2aa5aea24c1813.zip
buffer: let WriteFloatGeneric silently drop values
Documentation currently states that setting noAssert and passing a value larger than can fit in the Buffer will cause data to be silently dropped. Change implementation to match documented behavior. Fixes: https://github.com/nodejs/node/issues/3766 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-arraybuffer.js')
-rw-r--r--test/parallel/test-buffer-arraybuffer.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/parallel/test-buffer-arraybuffer.js b/test/parallel/test-buffer-arraybuffer.js
index c13d0ba411..c25de262ea 100644
--- a/test/parallel/test-buffer-arraybuffer.js
+++ b/test/parallel/test-buffer-arraybuffer.js
@@ -44,3 +44,10 @@ assert.throws(function() {
AB.prototype.__proto__ = ArrayBuffer.prototype;
new Buffer(new AB());
}, TypeError);
+
+// write{Double,Float}{LE,BE} with noAssert should not crash, cf. #3766
+var b = new Buffer(1);
+b.writeFloatLE(11.11, 0, true);
+b.writeFloatBE(11.11, 0, true);
+b.writeDoubleLE(11.11, 0, true);
+b.writeDoubleBE(11.11, 0, true);