From 81ed50c5dad7ba821bbf1b51e638fff7fad6e052 Mon Sep 17 00:00:00 2001 From: Lauren Spiegel Date: Thu, 22 Sep 2016 20:13:00 -0700 Subject: [PATCH] test: add assertions to zero length buffer test 1) Add missing assertion that slicing a 0 length buffer does not throw 2) Add assertion that slicing a 0 length buffer has a length of 0 PR-URL: https://github.com/nodejs/node/pull/8729 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Ilkka Myller Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- test/parallel/test-buffer-slice.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-slice.js b/test/parallel/test-buffer-slice.js index 4cd5feb688..133d056b17 100644 --- a/test/parallel/test-buffer-slice.js +++ b/test/parallel/test-buffer-slice.js @@ -52,7 +52,8 @@ assert.equal(buf.slice('0', '-111'), ''); // try to slice a zero length Buffer // see https://github.com/joyent/node/issues/5881 -Buffer.alloc(0).slice(0, 1); +assert.doesNotThrow(() => Buffer.alloc(0).slice(0, 1)); +assert.strictEqual(Buffer.alloc(0).slice(0, 1).length, 0); { // Single argument slice