From acecd18da57d7f27699195dbeb726d09cc93699a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 10 Nov 2016 11:26:20 -0800 Subject: [PATCH 1/2] test: refactor test-zlib.js * minor layout changes for clarity * assert.equal() and assert.ok() swapped out for assert.strictEqual() * var -> const for modules included via require() --- test/parallel/test-zlib.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 044b71db1bddd0..438dd9fbb44082 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -4,12 +4,13 @@ const assert = require('assert'); const zlib = require('zlib'); const path = require('path'); -var zlibPairs = - [[zlib.Deflate, zlib.Inflate], - [zlib.Gzip, zlib.Gunzip], - [zlib.Deflate, zlib.Unzip], - [zlib.Gzip, zlib.Unzip], - [zlib.DeflateRaw, zlib.InflateRaw]]; +var zlibPairs = [ + [zlib.Deflate, zlib.Inflate], + [zlib.Gzip, zlib.Gunzip], + [zlib.Deflate, zlib.Unzip], + [zlib.Gzip, zlib.Unzip], + [zlib.DeflateRaw, zlib.InflateRaw] +]; // how fast to trickle through the slowstream var trickle = [128, 1024, 1024 * 1024]; @@ -36,7 +37,7 @@ if (!process.env.PUMMEL) { strategy = [0]; } -var fs = require('fs'); +const fs = require('fs'); var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt']; @@ -45,13 +46,13 @@ if (process.env.FAST) { testFiles = ['person.jpg']; } -var tests = {}; +const tests = {}; testFiles.forEach(function(file) { tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file)); }); -var util = require('util'); -var stream = require('stream'); +const util = require('util'); +const stream = require('stream'); // stream that saves everything @@ -197,11 +198,16 @@ Object.keys(tests).forEach(function(file) { ss.pipe(def).pipe(inf).pipe(buf); ss.end(test); }); - }); }); }); }); }); }); // sad stallman is sad. + }); + }); + }); + }); + }); + }); }); process.on('exit', function(code) { console.log('1..' + done); - assert.equal(done, total, (total - done) + ' tests left unfinished'); - assert.ok(!failures, 'some test failures'); + assert.strictEqual(done, total, (total - done) + ' tests left unfinished'); + assert.strictEqual(failures, 0, 'some test failures'); }); From afb904f6b0357d1b3736c69617911970fbd228da Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 12 Nov 2016 12:57:53 -0800 Subject: [PATCH 2/2] squash: nit --- test/parallel/test-zlib.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 438dd9fbb44082..522916e45cf01a 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -3,6 +3,9 @@ const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); const path = require('path'); +const fs = require('fs'); +const util = require('util'); +const stream = require('stream'); var zlibPairs = [ [zlib.Deflate, zlib.Inflate], @@ -37,8 +40,6 @@ if (!process.env.PUMMEL) { strategy = [0]; } -const fs = require('fs'); - var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt']; if (process.env.FAST) { @@ -51,9 +52,6 @@ testFiles.forEach(function(file) { tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file)); }); -const util = require('util'); -const stream = require('stream'); - // stream that saves everything function BufferStream() {