mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
789 B
31 lines
789 B
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const util = require('util');
|
|
const uv = process.binding('uv');
|
|
|
|
const keys = Object.keys(uv);
|
|
|
|
keys.forEach((key) => {
|
|
if (key === 'errname')
|
|
return;
|
|
|
|
assert.doesNotThrow(() => {
|
|
const err = util._errnoException(uv[key], 'test');
|
|
const name = uv.errname(uv[key]);
|
|
assert.strictEqual(err.code, err.errno);
|
|
assert.strictEqual(err.code, name);
|
|
assert.strictEqual(err.message, `test ${name}`);
|
|
});
|
|
});
|
|
|
|
[0, 1, 'test', {}, [], Infinity, -Infinity, NaN].forEach((key) => {
|
|
common.expectsError(
|
|
() => util._errnoException(key),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message: 'The "err" argument must be of type negative number'
|
|
});
|
|
});
|
|
|