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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
efcbf611d7
commit
edb78aa2a6
@ -5,7 +5,7 @@
|
|||||||
// are most relevant.
|
// are most relevant.
|
||||||
const constants = process.binding('constants');
|
const constants = process.binding('constants');
|
||||||
Object.assign(exports,
|
Object.assign(exports,
|
||||||
constants.os.errors,
|
constants.os.errno,
|
||||||
constants.os.signals,
|
constants.os.signals,
|
||||||
constants.fs,
|
constants.fs,
|
||||||
constants.crypto);
|
constants.crypto);
|
||||||
|
@ -1,12 +1,26 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
const constants = process.binding('constants');
|
const binding = process.binding('constants');
|
||||||
|
const constants = require('constants');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
assert.ok(constants);
|
assert.ok(binding);
|
||||||
assert.ok(constants.os);
|
assert.ok(binding.os);
|
||||||
assert.ok(constants.os.signals);
|
assert.ok(binding.os.signals);
|
||||||
assert.ok(constants.os.errno);
|
assert.ok(binding.os.errno);
|
||||||
assert.ok(constants.fs);
|
assert.ok(binding.fs);
|
||||||
assert.ok(constants.crypto);
|
assert.ok(binding.crypto);
|
||||||
|
|
||||||
|
['os', 'fs', 'crypto'].forEach((l) => {
|
||||||
|
Object.keys(binding[l]).forEach((k) => {
|
||||||
|
if (typeof binding[l][k] === 'object') { // errno and signals
|
||||||
|
Object.keys(binding[l][k]).forEach((j) => {
|
||||||
|
assert.strictEqual(binding[l][k][j], constants[j]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (l !== 'os') { // top level os constant isn't currently copied
|
||||||
|
assert.strictEqual(binding[l][k], constants[k]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user