| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dd9aefd commit eba9add
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,11 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - require('../common'); | ||
| 3 | - const assert = require('assert'); | ||
| 2 | + const common = require('../common'); | ||
| 4 | 3 | ||
| 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. | ||
| 10 | 6 | ||
| 11 | - t.close(onclose); | ||
| 12 | - t.close(onclose); | ||
| 7 | + const Timer = process.binding('timer_wrap').Timer; | ||
| 8 | + const t = new Timer(); | ||
| 13 | 9 | ||
| 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')); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments