From fc8a9efe1f80a902171863c32cfe4acaa52022b4 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Wed, 20 Mar 2013 10:58:23 -0700 Subject: [PATCH] failing test for an indexed modification --- test/indexes.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/indexes.js b/test/indexes.js index 10cb692..8802ab3 100644 --- a/test/indexes.js +++ b/test/indexes.js @@ -1,7 +1,7 @@ var B = require('../index.js').Buffer; var test = require('tap').test; -test("indexes from a string", function(t) { +test('indexes from a string', function(t) { t.plan(3); var buf = new B('abc'); t.equal(buf[0], 97); @@ -9,10 +9,21 @@ test("indexes from a string", function(t) { t.equal(buf[2], 99); }); -test("indexes from an array", function(t) { +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); }); + +test('set then modify indexes from an array', function(t) { + t.plan(4); + var buf = new B([ 97, 98, 99 ]); + t.equal(buf[2], 99); + t.equal(buf.toString(), 'abc'); + + buf[2] += 10; + t.equal(buf[2], 109); + t.equal(buf.toString(), 'abm'); +}); -- 2.34.1