From 8800d6f0e2e2b4ee43c568ef7eff8c1f1ab8f941 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 7 May 2014 17:24:50 -0700 Subject: [PATCH] add failing test for write return offset --- test/buffer.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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') ] -- 2.34.1