mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

Changes in test-zlib-from-string is because var->const pushed us over the max char limit per line. PR-URL: https://github.com/nodejs/node/pull/8627 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
34 lines
680 B
JavaScript
34 lines
680 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
|
|
const gzip = zlib.createGzip();
|
|
const gunz = zlib.createUnzip();
|
|
|
|
gzip.pipe(gunz);
|
|
|
|
var output = '';
|
|
const input = 'A line of data\n';
|
|
gunz.setEncoding('utf8');
|
|
gunz.on('data', function(c) {
|
|
output += c;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(output, input);
|
|
|
|
// Make sure that the flush flag was set back to normal
|
|
assert.equal(gzip._flushFlag, zlib.constants.Z_NO_FLUSH);
|
|
|
|
console.log('ok');
|
|
});
|
|
|
|
// make sure that flush/write doesn't trigger an assert failure
|
|
gzip.flush(); write();
|
|
function write() {
|
|
gzip.write(input);
|
|
gzip.end();
|
|
gunz.read(0);
|
|
}
|