| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e97c610 commit 9808985
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 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 more-or-less | ||
| 6 | + // immediately. | ||
| 7 | + // | ||
| 8 | + // Ref: https://github.com/nodejs/node-v0.x-archive/pull/897 | ||
| 9 | + | ||
| 10 | + const common = require('../common'); | ||
| 11 | + const assert = require('assert'); | ||
| 12 | + | ||
| 13 | + const t = Date.now(); | ||
| 14 | + setTimeout(common.mustCall(function() { | ||
| 15 | + const diff = Date.now() - t; | ||
| 16 | + assert.ok(diff < 100, `timer fired after ${diff} ms`); | ||
| 17 | + }), 0.1); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments