xref: /third_party/node/test/parallel/test-uv-binding-constant.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 { internalBinding } = require('internal/test/binding');
71cb0ef41Sopenharmony_ciconst uv = internalBinding('uv');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci// Ensures that the `UV_...` values in internalBinding('uv')
101cb0ef41Sopenharmony_ci// are constants.
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst keys = Object.keys(uv);
131cb0ef41Sopenharmony_cikeys.forEach((key) => {
141cb0ef41Sopenharmony_ci  if (key.startsWith('UV_')) {
151cb0ef41Sopenharmony_ci    const val = uv[key];
161cb0ef41Sopenharmony_ci    assert.throws(() => uv[key] = 1, TypeError);
171cb0ef41Sopenharmony_ci    assert.strictEqual(uv[key], val);
181cb0ef41Sopenharmony_ci  }
191cb0ef41Sopenharmony_ci});
20

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