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() PR-URL: https://github.com/nodejs/node/pull/9544 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
5a61b99d98
commit
fc44bd4d0b
@ -3,13 +3,17 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const util = require('util');
|
||||||
|
const stream = require('stream');
|
||||||
|
|
||||||
var zlibPairs =
|
var zlibPairs = [
|
||||||
[[zlib.Deflate, zlib.Inflate],
|
[zlib.Deflate, zlib.Inflate],
|
||||||
[zlib.Gzip, zlib.Gunzip],
|
[zlib.Gzip, zlib.Gunzip],
|
||||||
[zlib.Deflate, zlib.Unzip],
|
[zlib.Deflate, zlib.Unzip],
|
||||||
[zlib.Gzip, zlib.Unzip],
|
[zlib.Gzip, zlib.Unzip],
|
||||||
[zlib.DeflateRaw, zlib.InflateRaw]];
|
[zlib.DeflateRaw, zlib.InflateRaw]
|
||||||
|
];
|
||||||
|
|
||||||
// how fast to trickle through the slowstream
|
// how fast to trickle through the slowstream
|
||||||
var trickle = [128, 1024, 1024 * 1024];
|
var trickle = [128, 1024, 1024 * 1024];
|
||||||
@ -36,8 +40,6 @@ if (!process.env.PUMMEL) {
|
|||||||
strategy = [0];
|
strategy = [0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var fs = require('fs');
|
|
||||||
|
|
||||||
var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt'];
|
var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt'];
|
||||||
|
|
||||||
if (process.env.FAST) {
|
if (process.env.FAST) {
|
||||||
@ -45,14 +47,11 @@ if (process.env.FAST) {
|
|||||||
testFiles = ['person.jpg'];
|
testFiles = ['person.jpg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
var tests = {};
|
const tests = {};
|
||||||
testFiles.forEach(function(file) {
|
testFiles.forEach(function(file) {
|
||||||
tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file));
|
tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file));
|
||||||
});
|
});
|
||||||
|
|
||||||
var util = require('util');
|
|
||||||
var stream = require('stream');
|
|
||||||
|
|
||||||
|
|
||||||
// stream that saves everything
|
// stream that saves everything
|
||||||
function BufferStream() {
|
function BufferStream() {
|
||||||
@ -197,11 +196,16 @@ Object.keys(tests).forEach(function(file) {
|
|||||||
ss.pipe(def).pipe(inf).pipe(buf);
|
ss.pipe(def).pipe(inf).pipe(buf);
|
||||||
ss.end(test);
|
ss.end(test);
|
||||||
});
|
});
|
||||||
}); }); }); }); }); }); // sad stallman is sad.
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('exit', function(code) {
|
process.on('exit', function(code) {
|
||||||
console.log('1..' + done);
|
console.log('1..' + done);
|
||||||
assert.equal(done, total, (total - done) + ' tests left unfinished');
|
assert.strictEqual(done, total, (total - done) + ' tests left unfinished');
|
||||||
assert.ok(!failures, 'some test failures');
|
assert.strictEqual(failures, 0, 'some test failures');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user