From: Feross Aboukhadijeh Date: Thu, 17 Jul 2014 05:56:44 +0000 (-0700) Subject: add failing test for new buffer from buffer.toJSON() for #37 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=eb077c45243e6c3f74c828b24f857fba40cd7846;p=buffer.git add failing test for new buffer from buffer.toJSON() for #37 --- diff --git a/test/basic.js b/test/basic.js index a369c62..a24986b 100644 --- a/test/basic.js +++ b/test/basic.js @@ -161,6 +161,15 @@ test('buffer toJSON()', function (t) { t.end() }) +test('new buffer from buffer.toJSON() output', function (t) { + var buf = new B('test') + var json = JSON.stringify(buf) + var obj = JSON.parse(json) + var copy = new B(obj) + t.ok(buf.equals(copy)) + t.end() +}) + test('buffer copy example', function (t) { var buf1 = new B(26) var buf2 = new B(26)