0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-zlib-const.js
James M Snell 197a465280 zlib: move constants into zlib.constants
zlib constants were previously being added to binding in node_zlib.cc.
This moves the zlib constants to node_constants.cc for consistency with
the recent constants refactoring:
  https://github.com/nodejs/node/pull/6534

Adds require('zlib').constants to expose the constants
Docs-only deprecates the constants hung directly off require('zlib')
Removes a couple constants from the docs that apparently no longer
exist in the code

PR-URL: https://github.com/nodejs/node/pull/7203
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-11 17:24:35 -07:00

18 lines
555 B
JavaScript

/* eslint-disable strict */
require('../common');
var assert = require('assert');
var zlib = require('zlib');
assert.equal(zlib.constants.Z_OK, 0, 'Z_OK should be 0');
zlib.constants.Z_OK = 1;
assert.equal(zlib.constants.Z_OK, 0, 'Z_OK should be 0');
assert.equal(zlib.codes.Z_OK, 0, 'Z_OK should be 0');
zlib.codes.Z_OK = 1;
assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0');
zlib.codes = {Z_OK: 1};
assert.equal(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0');
assert.ok(Object.isFrozen(zlib.codes), 'zlib.codes should be frozen');