Skip to content

Commit

Permalink
test: more informative test failure messages
Browse files Browse the repository at this point in the history
PR-URL: nodejs#15977
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
alec-ferguson-ck authored and BridgeAR committed Oct 8, 2017
1 parent 99237cf commit 91724cb
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions test/parallel/test-zlib-const.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,35 @@ const assert = require('assert');

const zlib = require('zlib');

assert.strictEqual(zlib.constants.Z_OK, 0, 'Z_OK should be 0');
assert.strictEqual(zlib.constants.Z_OK, 0,
[
'Expected Z_OK to be 0;',
`got ${zlib.constants.Z_OK}`
].join(' '));
zlib.constants.Z_OK = 1;
assert.strictEqual(zlib.constants.Z_OK, 0, 'Z_OK should be 0');
assert.strictEqual(zlib.constants.Z_OK, 0,
[
'Z_OK should be immutable.',
`Expected to get 0, got ${zlib.constants.Z_OK}`
].join(' '));

assert.strictEqual(zlib.codes.Z_OK, 0, 'Z_OK should be 0');
assert.strictEqual(zlib.codes.Z_OK, 0,
`Expected Z_OK to be 0; got ${zlib.codes.Z_OK}`);
zlib.codes.Z_OK = 1;
assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0');
assert.strictEqual(zlib.codes.Z_OK, 0,
[
'Z_OK should be immutable.',
`Expected to get 0, got ${zlib.codes.Z_OK}`
].join(' '));
zlib.codes = { Z_OK: 1 };
assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0');
assert.strictEqual(zlib.codes.Z_OK, 0,
[
'Z_OK should be immutable.',
`Expected to get 0, got ${zlib.codes.Z_OK}`
].join(' '));

assert.ok(Object.isFrozen(zlib.codes), 'zlib.codes should be frozen');
assert.ok(Object.isFrozen(zlib.codes),
[
'Expected zlib.codes to be frozen, but Object.isFrozen',
`returned ${Object.isFrozen(zlib.codes)}`
].join(' '));

0 comments on commit 91724cb

Please sign in to comment.