From: Feross Aboukhadijeh Date: Thu, 8 May 2014 00:24:50 +0000 (-0700) Subject: add failing test for write return offset X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=8800d6f0e2e2b4ee43c568ef7eff8c1f1ab8f941;p=buffer.git add failing test for write return offset --- diff --git a/test/buffer.js b/test/buffer.js index bff5f3b..24b3f66 100644 --- a/test/buffer.js +++ b/test/buffer.js @@ -194,6 +194,16 @@ test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) { t.end() }) +test('test offset returns are correct', function (t) { + var b = new B(16) + t.equal(4, b.writeUInt32LE(0, 0)) + t.equal(6, b.writeUInt16LE(0, 4)) + t.equal(7, b.writeUInt8(0, 6)) + t.equal(8, b.writeInt8(0, 7)) + t.equal(16, b.writeDoubleLE(0, 8)) + t.end() +}) + test('concat() a varying number of buffers', function (t) { var zero = [] var one = [ new B('asdf') ]