Sha256: d58923ff9e79b4787d05c88d39c19618b67193f5acde40a2d8926fed5e7ed5d9

Contents?: true

Size: 1.81 KB

Versions: 73

Compression:

Stored size: 1.81 KB

Contents

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var tape = require('tape');
var zlib = require('../');
var fs = require('fs');

tape('write after flush', function(t) {
  t.plan(2);
  
  var gzip = zlib.createGzip();
  var gunz = zlib.createUnzip();

  gzip.pipe(gunz);

  var output = '';
  var input = 'A line of data\n';
  gunz.setEncoding('utf8');
  gunz.on('data', function(c) {
    output += c;
  });
  
  gunz.on('end', function() {
    t.equal(output, input);
    
    // Make sure that the flush flag was set back to normal
    t.equal(gzip._flushFlag, zlib.Z_NO_FLUSH);
  });
  
  // make sure that flush/write doesn't trigger an assert failure
  gzip.flush(); write();
  function write() {
    gzip.write(input);
    gzip.end();
    gunz.read(0);
  }
});

Version data entries

73 entries across 73 versions & 5 rubygems

Version Path
lanes-0.8.0 node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.6 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.5 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.4 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.3 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.2 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
brwy_rails-0.0.1 test/dummy/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
gulp_assets-1.0.0.pre.5 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
gulp_assets-1.0.0.pre.4 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
gulp_assets-1.0.0.pre.3 template/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.268 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.267 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.266 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.265 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.264 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.263 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.262 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.261 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js
smock-0.1.260 node_modules/webpack/node_modules/node-libs-browser/node_modules/browserify-zlib/test/test-zlib-write-after-flush.js