| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c60d87b commit 9d5170f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // Test for bug where a timer duration greater than 0 ms but less than 1 ms | ||
| 4 | + // resulted in the duration being set for 1000 ms. The expected behavior is | ||
| 5 | + // that the timeout would be set for 1 ms, and thus fire before timers set | ||
| 6 | + // with values greater than 1ms. | ||
| 7 | + // | ||
| 8 | + // Ref: https://github.com/nodejs/node-v0.x-archive/pull/897 | ||
| 9 | + | ||
| 10 | + const common = require('../common'); | ||
| 11 | + | ||
| 12 | + let timer; | ||
| 13 | + | ||
| 14 | + setTimeout(function() { | ||
| 15 | + clearTimeout(timer); | ||
| 16 | + }, 0.1); // 0.1 should be treated the same as 1, not 1000... | ||
| 17 | + | ||
| 18 | + timer = setTimeout(function() { | ||
| 19 | + common.fail('timers fired out of order'); | ||
| 20 | + }, 2); // ...so this timer should fire second. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments