Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eba9add

Browse filesBrowse files
BethGriggsItalo A. Casas
authored andcommitted
test: refactor test-timer-close
Refactor and simplify parallel/test-timer-close.js. Add comment to describe the test case. PR-URL: #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>
1 parent dd9aefd commit eba9add
Copy full SHA for eba9add

File tree

Expand file treeCollapse file tree

1 file changed

+7
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-12
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-timer-close.js‎

Copy file name to clipboard
+7-12Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
'use strict';
2-
require('../common');
3-
const assert = require('assert');
2+
const common = require('../common');
43

5-
var t = new (process.binding('timer_wrap').Timer)();
6-
var called = 0;
7-
function onclose() {
8-
called++;
9-
}
4+
// Make sure handle._handle.close(callback) is idempotent by closing a timer
5+
// twice. The first function should be called, the second one should not.
106

11-
t.close(onclose);
12-
t.close(onclose);
7+
const Timer = process.binding('timer_wrap').Timer;
8+
const t = new Timer();
139

14-
process.on('exit', function() {
15-
assert.equal(1, called);
16-
});
10+
t.close(common.mustCall(function() {}));
11+
t.close(() => common.fail('This should never be called'));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.