xref: /third_party/node/test/node-api/test_async/test-loop.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/node-api/test_async/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst test_async = require(`./build/${common.buildType}/test_async`);
51cb0ef41Sopenharmony_ciconst iterations = 500;
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cilet x = 0;
81cb0ef41Sopenharmony_ciconst workDone = common.mustCall((status) => {
91cb0ef41Sopenharmony_ci  assert.strictEqual(status, 0);
101cb0ef41Sopenharmony_ci  if (++x < iterations) {
111cb0ef41Sopenharmony_ci    setImmediate(() => test_async.DoRepeatedWork(workDone));
121cb0ef41Sopenharmony_ci  }
131cb0ef41Sopenharmony_ci}, iterations);
141cb0ef41Sopenharmony_citest_async.DoRepeatedWork(workDone);
15

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