| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 74ff804 commit fa8baa2
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - require('../common'); | ||
| 2 | + const common = require('../common'); | ||
| 3 | 3 | const assert = require('assert'); | |
| 4 | 4 | ||
| 5 | 5 | const inputs = [ | |
@@ -18,13 +18,14 @@ const inputs = [ | |||
| 18 | 18 | -10, | |
| 19 | 19 | -1, | |
| 20 | 20 | -0.5, | |
| 21 | + -0.1, | ||
| 21 | 22 | -0.0, | |
| 22 | 23 | 0, | |
| 23 | 24 | 0.0, | |
| 25 | + 0.1, | ||
| 24 | 26 | 0.5, | |
| 25 | 27 | 1, | |
| 26 | 28 | 1.0, | |
| 27 | - 10, | ||
| 28 | 29 | 2147483648, // browser behaviour: timeouts > 2^31-1 run on next tick | |
| 29 | 30 | 12345678901234 // ditto | |
| 30 | 31 | ]; | |
@@ -43,10 +44,17 @@ inputs.forEach(function(value, index) { | |||
| 43 | 44 | }, value); | |
| 44 | 45 | }); | |
| 45 | 46 | ||
| 46 | - process.on('exit', function() { | ||
| 47 | - // assert that all timers have run | ||
| 47 | + // All values in inputs array coerce to 1 ms. Therefore, they should all run | ||
| 48 | + // before a timer set here for 2 ms. | ||
| 49 | + | ||
| 50 | + setTimeout(common.mustCall(function() { | ||
| 51 | + // assert that all other timers have run | ||
| 48 | 52 | inputs.forEach(function(value, index) { | |
| 49 | - assert.strictEqual(true, timeouts[index]); | ||
| 50 | - assert.strictEqual(true, intervals[index]); | ||
| 53 | + assert(timeouts[index]); | ||
| 54 | + assert(intervals[index]); | ||
| 51 | 55 | }); | |
| 52 | - }); | ||
| 56 | + }), 2); | ||
| 57 | + | ||
| 58 | + // Test 10 ms timeout separately. | ||
| 59 | + setTimeout(common.mustCall(function() {}), 10); | ||
| 60 | + setInterval(common.mustCall(function() { clearInterval(this); }), 10); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments