react / wstein / node_modules / browserify / node_modules / browserify-zlib / test / ignored / test-zlib-dictionary-fail.js
80536 views// Copyright Joyent, Inc. and other Node contributors.1//2// Permission is hereby granted, free of charge, to any person obtaining a3// copy of this software and associated documentation files (the4// "Software"), to deal in the Software without restriction, including5// without limitation the rights to use, copy, modify, merge, publish,6// distribute, sublicense, and/or sell copies of the Software, and to permit7// persons to whom the Software is furnished to do so, subject to the8// following conditions:9//10// The above copyright notice and this permission notice shall be included11// in all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS14// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF15// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN16// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,17// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR18// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE19// USE OR OTHER DEALINGS IN THE SOFTWARE.2021var common = require('../common.js');22var assert = require('assert');23var zlib = require('zlib');2425// Should raise an error, not trigger an assertion in src/node_zlib.cc26(function() {27var stream = zlib.createInflate();2829stream.on('error', common.mustCall(function(err) {30assert(/Missing dictionary/.test(err.message));31}));3233// String "test" encoded with dictionary "dict".34stream.write(Buffer([0x78,0xBB,0x04,0x09,0x01,0xA5]));35})();3637// Should raise an error, not trigger an assertion in src/node_zlib.cc38(function() {39var stream = zlib.createInflate({ dictionary: Buffer('fail') });4041stream.on('error', common.mustCall(function(err) {42assert(/Bad dictionary/.test(err.message));43}));4445// String "test" encoded with dictionary "dict".46stream.write(Buffer([0x78,0xBB,0x04,0x09,0x01,0xA5]));47})();484950