From e3aa93614e81dd5ef4b915210e6062b8003b6bff Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Mon, 1 Sep 2014 16:44:27 -0700 Subject: [PATCH] one more test to make sure things are working --- test/script.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/script.js b/test/script.js index eef22aa..ceb418b 100644 --- a/test/script.js +++ b/test/script.js @@ -62,6 +62,19 @@ describe('Script', function() { script.chunks[0].toString('hex').should.equal('010203'); }); + it('should parse this buffer an OP code, data, and another OP code', function() { + var buf = new Buffer([0, 0, 0, 0, 0, 0, 1, 2, 3, 0]); + buf[0] = Opcode('OP_0').toNumber(); + buf[1] = Opcode('OP_PUSHDATA4').toNumber(); + buf.writeUInt16LE(3, 2); + buf[buf.length - 1] = Opcode('OP_0').toNumber(); + var script = Script().fromBuffer(buf); + script.chunks.length.should.equal(3); + script.chunks[0].should.equal(buf[0]); + script.chunks[1].toString('hex').should.equal('010203'); + script.chunks[2].should.equal(buf[buf.length - 1]); + }); + }); });