Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c9aa18

Browse filesBrowse files
bengladdaleax
authored andcommitted
constants: errors -> errno
lib/constants.js was incorrectly copying the constants from the binding, by copying from `contants.os.errors` instead of `constants.os.errno`. PR-URL: #9349 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 74c3283 commit 5c9aa18
Copy full SHA for 5c9aa18

File tree

Expand file treeCollapse file tree

2 files changed

+22
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-8
lines changed
Open diff view settings
Collapse file

‎lib/constants.js‎

Copy file name to clipboardExpand all lines: lib/constants.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// are most relevant.
66
const constants = process.binding('constants');
77
Object.assign(exports,
8-
constants.os.errors,
8+
constants.os.errno,
99
constants.os.signals,
1010
constants.fs,
1111
constants.crypto);
Collapse file

‎test/parallel/test-constants.js‎

Copy file name to clipboard
+21-7Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
'use strict';
22

33
require('../common');
4-
const constants = process.binding('constants');
4+
const binding = process.binding('constants');
5+
const constants = require('constants');
56
const assert = require('assert');
67

7-
assert.ok(constants);
8-
assert.ok(constants.os);
9-
assert.ok(constants.os.signals);
10-
assert.ok(constants.os.errno);
11-
assert.ok(constants.fs);
12-
assert.ok(constants.crypto);
8+
assert.ok(binding);
9+
assert.ok(binding.os);
10+
assert.ok(binding.os.signals);
11+
assert.ok(binding.os.errno);
12+
assert.ok(binding.fs);
13+
assert.ok(binding.crypto);
14+
15+
['os', 'fs', 'crypto'].forEach((l) => {
16+
Object.keys(binding[l]).forEach((k) => {
17+
if (typeof binding[l][k] === 'object') { // errno and signals
18+
Object.keys(binding[l][k]).forEach((j) => {
19+
assert.strictEqual(binding[l][k][j], constants[j]);
20+
});
21+
}
22+
if (l !== 'os') { // top level os constant isn't currently copied
23+
assert.strictEqual(binding[l][k], constants[k]);
24+
}
25+
});
26+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.