Sha256: 800bff5f025237569f9c9d7ff464d9b3ad67cc5850700cb63210eb2e355dcd83

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

'use strict';
const common = require('../common');
const assert = require('assert');
const zlib = require('zlib');

// String "test" encoded with dictionary "dict".
const input = Buffer.from([0x78, 0xBB, 0x04, 0x09, 0x01, 0xA5]);

{
  const stream = zlib.createInflate();

  stream.on('error', common.mustCall(function(err) {
    assert(/Missing dictionary/.test(err.message));
  }));

  stream.write(input);
}

{
  const stream = zlib.createInflate({ dictionary: Buffer.from('fail') });

  stream.on('error', common.mustCall(function(err) {
    assert(/Bad dictionary/.test(err.message));
  }));

  stream.write(input);
}

{
  const stream = zlib.createInflateRaw({ dictionary: Buffer.from('fail') });

  stream.on('error', common.mustCall(function(err) {
    // It's not possible to separate invalid dict and invalid data when using
    // the raw format
    assert(/invalid/.test(err.message));
  }));

  stream.write(input);
}

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/test/parallel/test-zlib-dictionary-fail.js
node-compiler-0.9.0 vendor/node-v7.2.1/test/parallel/test-zlib-dictionary-fail.js
node-compiler-0.8.0 vendor/node-v7.2.0/test/parallel/test-zlib-dictionary-fail.js
node-compiler-0.7.0 vendor/node-v6.9.1/test/parallel/test-zlib-dictionary-fail.js
node-compiler-0.7.0 vendor/node-v7.1.0/test/parallel/test-zlib-dictionary-fail.js