From: Feross Aboukhadijeh Date: Tue, 8 Apr 2014 08:00:12 +0000 (-0700) Subject: tests: remove unneeded t.plan() calls X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=e6fb31a4245ee03ca288672526ec7bed697af877;p=buffer.git tests: remove unneeded t.plan() calls all tests are synchronous --- diff --git a/test/basic.js b/test/basic.js index ffb2457..5a1b7ba 100644 --- a/test/basic.js +++ b/test/basic.js @@ -10,7 +10,6 @@ test('new buffer from array', function (t) { }) test('new buffer from string', function (t) { - t.plan(1) t.equal( new B('hey', 'utf8').toString(), 'hey' @@ -138,7 +137,6 @@ test('buffer toArrayBuffer()', function (t) { }) test('buffer toJSON()', function (t) { - t.plan(1) var data = [1, 2, 3, 4] t.deepEqual( new B(data).toJSON(), @@ -148,10 +146,8 @@ test('buffer toJSON()', function (t) { }) test('buffer copy example', function (t) { - t.plan(1) - - buf1 = new B(26) - buf2 = new B(26) + var buf1 = new B(26) + var buf2 = new B(26) for (var i = 0 ; i < 26 ; i++) { buf1[i] = i + 97; // 97 is ASCII a diff --git a/test/buffer.js b/test/buffer.js index 9fdfea1..2f306c6 100644 --- a/test/buffer.js +++ b/test/buffer.js @@ -26,22 +26,20 @@ test('utf8 to utf8', function (t) { }) test('utf16le to utf16', function (t) { - t.plan(1); t.equal( new B(new B('abcd', 'utf8').toString('utf16le'), 'utf16le').toString('utf8'), 'abcd' - ); - t.end(); -}); + ) + t.end() +}) test('utf16le to hex', function (t) { - t.plan(1); t.equal( new B('abcd', 'utf16le').toString('hex'), '6100620063006400' - ); - t.end(); -}); + ) + t.end() +}) test('ascii buffer to base64', function (t) { t.equal( @@ -197,7 +195,6 @@ test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) { }) test('concat() a varying number of buffers', function (t) { - t.plan(5) var zero = [] var one = [ new B('asdf') ] var long = [] @@ -217,7 +214,6 @@ test('concat() a varying number of buffers', function (t) { }) test('fill', function(t) { - t.plan(1) var b = new B(10) b.fill(2) t.equal(b.toString('hex'), '02020202020202020202') @@ -225,7 +221,6 @@ test('fill', function(t) { }) test('copy() empty buffer with sourceEnd=0', function (t) { - t.plan(1) var source = new B([42]) var destination = new B([43]) source.copy(destination, 0, 0, 0) @@ -234,7 +229,6 @@ test('copy() empty buffer with sourceEnd=0', function (t) { }) test('copy() after slice()', function(t) { - t.plan(1) var source = new B(200) var dest = new B(200) var expected = new B(200) @@ -242,7 +236,7 @@ test('copy() after slice()', function(t) { source[i] = i dest[i] = 0 } - + source.slice(2).copy(dest) source.copy(expected, 0, 2) t.deepEqual(dest, expected) @@ -250,7 +244,6 @@ test('copy() after slice()', function(t) { }) test('base64 ignore whitespace', function(t) { - t.plan(1) var text = '\n YW9ldQ== ' var buf = new B(text, 'base64') t.equal(buf.toString(), 'aoeu') @@ -258,7 +251,6 @@ test('base64 ignore whitespace', function(t) { }) test('buffer.slice sets indexes', function (t) { - t.plan(1) t.equal((new B('hallo')).slice(0, 5).toString(), 'hallo') t.end() }) @@ -271,7 +263,6 @@ test('buffer.slice out of range', function (t) { }) test('base64 strings without padding', function (t) { - t.plan(1) t.equal((new B('YW9ldQ', 'base64').toString()), 'aoeu') t.end() }) diff --git a/test/indexes.js b/test/indexes.js index 88879c8..783bfa5 100644 --- a/test/indexes.js +++ b/test/indexes.js @@ -2,23 +2,22 @@ var B = require('../').Buffer var test = require('tape') 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) + t.end() }) 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) + t.end() }) 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') @@ -26,4 +25,5 @@ test('set then modify indexes from an array', function(t) { buf[2] += 10 t.equal(buf[2], 109) t.equal(buf.toString(), 'abm') + t.end() }) diff --git a/test/is-buffer.js b/test/is-buffer.js index b3f494d..8fba076 100644 --- a/test/is-buffer.js +++ b/test/is-buffer.js @@ -2,7 +2,6 @@ var B = require('../').Buffer var test = require('tape') test('Buffer.isBuffer', function (t) { - t.plan(3) t.equal(B.isBuffer(new B('hey', 'utf8')), true) t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true) t.equal(B.isBuffer('hey'), false) diff --git a/test/is-encoding.js b/test/is-encoding.js index ff91cd8..b408434 100644 --- a/test/is-encoding.js +++ b/test/is-encoding.js @@ -2,7 +2,6 @@ var B = require('../').Buffer var test = require('tape') test('Buffer.isEncoding', function (t) { - t.plan(3) t.equal(B.isEncoding('HEX'), true) t.equal(B.isEncoding('hex'), true) t.equal(B.isEncoding('bad'), false) diff --git a/test/utf16.js b/test/utf16.js index d33c2d3..d34f72b 100644 --- a/test/utf16.js +++ b/test/utf16.js @@ -2,7 +2,6 @@ var B = require('../').Buffer var test = require('tape') test('detect utf16 surrogate pairs', function(t) { - t.plan(1) var text = '\uD83D\uDE38' + '\uD83D\uDCAD' + '\uD83D\uDC4D' var buf = new B(text) t.equal(text, buf.toString()) @@ -10,7 +9,6 @@ test('detect utf16 surrogate pairs', function(t) { }) test('throw on orphaned utf16 surrogate lead code point', function(t) { - t.plan(1) var text = '\uD83D\uDE38' + '\uD83D' + '\uD83D\uDC4D' var err try { @@ -23,7 +21,6 @@ test('throw on orphaned utf16 surrogate lead code point', function(t) { }) test('throw on orphaned utf16 surrogate trail code point', function(t) { - t.plan(1) var text = '\uD83D\uDE38' + '\uDCAD' + '\uD83D\uDC4D' var err try {