mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 20:08:02 +00:00

Refactor and simplify parallel/test-timer-close.js. Add comment to describe the test case. PR-URL: https://github.com/nodejs/node/pull/10517 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
12 lines
379 B
JavaScript
12 lines
379 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// Make sure handle._handle.close(callback) is idempotent by closing a timer
|
|
// twice. The first function should be called, the second one should not.
|
|
|
|
const Timer = process.binding('timer_wrap').Timer;
|
|
const t = new Timer();
|
|
|
|
t.close(common.mustCall(function() {}));
|
|
t.close(() => common.fail('This should never be called'));
|