Skip to content

Commit

Permalink
test: add assertions to zero length buffer test
Browse files Browse the repository at this point in the history
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: nodejs#8729
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Ilkka Myller <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
LaurenSpiegel authored and jasnell committed Sep 26, 2016
1 parent 289d862 commit 927661f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-buffer-slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 927661f

Please sign in to comment.