mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 17:10:40 +00:00

In zlib module, a dozen constants were exported to user land, If user change the constant, maybe lead unexcepted error. Make them readonly and freezon. PR-URL: https://github.com/iojs/io.js/pull/1361 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
17 lines
510 B
JavaScript
17 lines
510 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var zlib = require('zlib');
|
|
|
|
assert.equal(zlib.Z_OK, 0, 'Z_OK should be 0');
|
|
zlib.Z_OK = 1;
|
|
assert.equal(zlib.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');
|