From: Devon Govett Date: Tue, 8 Apr 2014 07:52:38 +0000 (-0700) Subject: Add test for copy() after slice() X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=d1c27ab0b21423995185c7be13c720989ef65d01;p=buffer.git Add test for copy() after slice() --- diff --git a/test/buffer.js b/test/buffer.js index b8112cd..a7bb690 100644 --- a/test/buffer.js +++ b/test/buffer.js @@ -253,6 +253,22 @@ test('copy() empty buffer with sourceEnd=0', function (t) { t.end() }) +test('copy() after slice()', function(t) { + t.plan(1) + var source = new B(200) + var dest = new B(200) + var expected = new B(200) + for (var i = 0; i < 200; i++) { + source[i] = i + dest[i] = 0 + } + + source.slice(2).copy(dest) + source.copy(expected, 0, 2) + t.deepEqual(dest, expected) + t.end() +}) + test('base64 ignore whitespace', function(t) { t.plan(1) var text = "\n YW9ldQ== "