Skip to content

Commit 306bdf7

Browse files
committed
add basic uv-errmap test
1 parent 7ea64bb commit 306bdf7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/parallel/test-uv-errmap.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
4+
const common = require('../common');
5+
const assert = require('assert');
6+
const {
7+
getSystemErrorMap,
8+
_errnoException
9+
} = require('util');
10+
11+
const { internalBinding } = require('internal/test/binding');
12+
const uv = internalBinding('uv');
13+
const uvKeys = Object.keys(uv);
14+
15+
const errMap = getSystemErrorMap();
16+
17+
uvKeys.forEach((key) => {
18+
if (!key.startsWith('UV_'))
19+
return;
20+
21+
const err = _errnoException(uv[key]);
22+
const name = uv.errname(uv[key]);
23+
assert.strictEqual(errMap.get(err.errno)[0], name);
24+
});

0 commit comments

Comments
 (0)