GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: enforce strict mode in test-zlib-const · nodejs/node@ad39367

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-zlib-const.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-zlib-const.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-zlib-const.js
+9-19Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable strict */
1+
'use strict';
22
require('../common');
33
const assert = require('assert');
44

@@ -9,27 +9,17 @@ assert.strictEqual(zlib.constants.Z_OK, 0,
99
'Expected Z_OK to be 0;',
1010
`got ${zlib.constants.Z_OK}`,
1111
].join(' '));
12-
zlib.constants.Z_OK = 1;
13-
assert.strictEqual(zlib.constants.Z_OK, 0,
14-
[
15-
'Z_OK should be immutable.',
16-
`Expected to get 0, got ${zlib.constants.Z_OK}`,
17-
].join(' '));
12+
13+
assert.throws(() => { zlib.constants.Z_OK = 1; },
14+
TypeError, 'zlib.constants.Z_OK should be immutable');
1815

1916
assert.strictEqual(zlib.codes.Z_OK, 0,
2017
`Expected Z_OK to be 0; got ${zlib.codes.Z_OK}`);
21-
zlib.codes.Z_OK = 1;
22-
assert.strictEqual(zlib.codes.Z_OK, 0,
23-
[
24-
'Z_OK should be immutable.',
25-
`Expected to get 0, got ${zlib.codes.Z_OK}`,
26-
].join(' '));
27-
zlib.codes = { Z_OK: 1 };
28-
assert.strictEqual(zlib.codes.Z_OK, 0,
29-
[
30-
'Z_OK should be immutable.',
31-
`Expected to get 0, got ${zlib.codes.Z_OK}`,
32-
].join(' '));
18+
assert.throws(() => { zlib.codes.Z_OK = 1; },
19+
TypeError, 'zlib.codes.Z_OK should be immutable');
20+
21+
assert.throws(() => { zlib.codes = { Z_OK: 1 }; },
22+
TypeError, 'zlib.codes should be immutable');
3323

3424
assert.ok(Object.isFrozen(zlib.codes),
3525
[

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.