From 5bb750252df56174843fa26df03c16c7aa683f8d Mon Sep 17 00:00:00 2001 From: Trevin Hofmann Date: Thu, 12 Feb 2015 09:27:42 -0600 Subject: [PATCH 1/2] Add inspect method to Opcode. --- lib/opcode.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/opcode.js b/lib/opcode.js index 9e4cfe32c..2471fbae2 100644 --- a/lib/opcode.js +++ b/lib/opcode.js @@ -233,4 +233,13 @@ Opcode.isSmallIntOp = function(opcode) { ((opcode >= Opcode.map.OP_1) && (opcode <= Opcode.map.OP_16))); }; +/** + * Will return a string formatted for the console + * + * @returns {String} Script opcode + */ +Opcode.prototype.inspect = function() { + return ''; +}; + module.exports = Opcode; From 2b137cc17c5af0b66a18fce59879c49dc0a121a1 Mon Sep 17 00:00:00 2001 From: Trevin Hofmann Date: Thu, 12 Feb 2015 09:44:28 -0600 Subject: [PATCH 2/2] Add test for Opcode.inspect --- test/opcode.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/opcode.js b/test/opcode.js index 150ef86fe..c0609891b 100644 --- a/test/opcode.js +++ b/test/opcode.js @@ -143,5 +143,10 @@ describe('Opcode', function() { }); + describe('#inspect', function() { + it('should output opcode by name, hex, and decimal', function() { + Opcode.fromString('OP_NOP').inspect().should.equal(''); + }); + }); });