From b95a0931330d122ce206bdb02d719478fa7bb7db Mon Sep 17 00:00:00 2001 From: James Halliday Date: Wed, 20 Mar 2013 10:32:57 -0700 Subject: [PATCH] put indexing into its own test --- test/buffer.js | 16 ---------------- test/indexes.js | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 test/indexes.js 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); +}); -- 2.34.1