From: James Halliday Date: Wed, 20 Mar 2013 17:32:57 +0000 (-0700) Subject: put indexing into its own test X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=b95a0931330d122ce206bdb02d719478fa7bb7db;p=buffer.git put indexing into its own test --- diff --git a/test/buffer.js b/test/buffer.js index bbb0c5b..77e4349 100644 --- a/test/buffer.js +++ b/test/buffer.js @@ -216,19 +216,3 @@ test("fill", function(t) { t.equal(b1.toString('hex'), b2.toString('hex')); t.end(); }); - -test("indexes from a string", function(t) { - t.plan(3); - var buf = new buffer.Buffer('abc'); - t.equal(buf[0], 97); - t.equal(buf[1], 98); - t.equal(buf[2], 99); -}); - -test("indexes from an array", function(t) { - t.plan(3); - var buf = new buffer.Buffer([ 97, 98, 99 ]); - t.equal(buf[0], 97); - t.equal(buf[1], 98); - t.equal(buf[2], 99); -}); diff --git a/test/indexes.js b/test/indexes.js new file mode 100644 index 0000000..10cb692 --- /dev/null +++ b/test/indexes.js @@ -0,0 +1,18 @@ +var B = require('../index.js').Buffer; +var test = require('tap').test; + +test("indexes from a string", function(t) { + t.plan(3); + var buf = new B('abc'); + t.equal(buf[0], 97); + t.equal(buf[1], 98); + t.equal(buf[2], 99); +}); + +test("indexes from an array", function(t) { + t.plan(3); + var buf = new B([ 97, 98, 99 ]); + t.equal(buf[0], 97); + t.equal(buf[1], 98); + t.equal(buf[2], 99); +});