xref: /third_party/node/test/parallel/test-uv-errmap.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst {
71cb0ef41Sopenharmony_ci  getSystemErrorMap,
81cb0ef41Sopenharmony_ci  _errnoException
91cb0ef41Sopenharmony_ci} = require('util');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst { internalBinding } = require('internal/test/binding');
121cb0ef41Sopenharmony_ciconst uv = internalBinding('uv');
131cb0ef41Sopenharmony_ciconst uvKeys = Object.keys(uv);
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst errMap = getSystemErrorMap();
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciuvKeys.forEach((key) => {
181cb0ef41Sopenharmony_ci  if (!key.startsWith('UV_'))
191cb0ef41Sopenharmony_ci    return;
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci  const err = _errnoException(uv[key]);
221cb0ef41Sopenharmony_ci  const name = uv.errname(uv[key]);
231cb0ef41Sopenharmony_ci  assert.strictEqual(errMap.get(err.errno)[0], name);
241cb0ef41Sopenharmony_ci});
25

Indexes created Thu Nov 07 10:32:03 CST 2024