11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ciconst { sleep } = require('internal/util'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// This test verifies that the next tick queue runs after each 81cb0ef41Sopenharmony_ci// individual Timeout, as well as each individual Immediate. 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cisetTimeout(common.mustCall(() => { 111cb0ef41Sopenharmony_ci process.nextTick(() => { 121cb0ef41Sopenharmony_ci // Confirm that clearing Timeouts from a next tick doesn't explode. 131cb0ef41Sopenharmony_ci clearTimeout(t2); 141cb0ef41Sopenharmony_ci clearTimeout(t3); 151cb0ef41Sopenharmony_ci }); 161cb0ef41Sopenharmony_ci}), 1); 171cb0ef41Sopenharmony_ciconst t2 = setTimeout(common.mustNotCall(), 1); 181cb0ef41Sopenharmony_ciconst t3 = setTimeout(common.mustNotCall(), 1); 191cb0ef41Sopenharmony_cisetTimeout(common.mustCall(), 1); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_cisleep(5); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_cisetImmediate(common.mustCall(() => { 241cb0ef41Sopenharmony_ci process.nextTick(() => { 251cb0ef41Sopenharmony_ci // Confirm that clearing Immediates from a next tick doesn't explode. 261cb0ef41Sopenharmony_ci clearImmediate(i2); 271cb0ef41Sopenharmony_ci clearImmediate(i3); 281cb0ef41Sopenharmony_ci }); 291cb0ef41Sopenharmony_ci})); 301cb0ef41Sopenharmony_ciconst i2 = setImmediate(common.mustNotCall()); 311cb0ef41Sopenharmony_ciconst i3 = setImmediate(common.mustNotCall()); 321cb0ef41Sopenharmony_cisetImmediate(common.mustCall()); 33