aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-timeout-with-non-integer.js
diff options
context:
space:
mode:
authorSuguru Motegi <suguru.motegi@gmail.com>2018-11-06 21:44:31 -0800
committerRich Trott <rtrott@gmail.com>2018-12-01 08:20:58 -0800
commite9de43549843da9f4f081cce917945878967df7e (patch)
tree3da377dec8f63657b5e193257d0f25aa15d8f8df /test/parallel/test-timers-timeout-with-non-integer.js
parenteb6741b15ebd93ffdd71e87cbc1350b9e94ef222 (diff)
downloadandroid-node-v8-e9de43549843da9f4f081cce917945878967df7e.tar.gz
android-node-v8-e9de43549843da9f4f081cce917945878967df7e.tar.bz2
android-node-v8-e9de43549843da9f4f081cce917945878967df7e.zip
timers: fix setTimeout expiration logic
Fix the timer logic to be the same as v10.30.0. Fixes: https://github.com/nodejs/node/issues/24203 PR-URL: https://github.com/nodejs/node/pull/24214 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'test/parallel/test-timers-timeout-with-non-integer.js')
-rw-r--r--test/parallel/test-timers-timeout-with-non-integer.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-timers-timeout-with-non-integer.js b/test/parallel/test-timers-timeout-with-non-integer.js
new file mode 100644
index 0000000000..96efc69e50
--- /dev/null
+++ b/test/parallel/test-timers-timeout-with-non-integer.js
@@ -0,0 +1,15 @@
+'use strict';
+const common = require('../common');
+
+/**
+ * This test is for https://github.com/nodejs/node/issues/24203
+ */
+let count = 50;
+const time = 1.00000000000001;
+const exec = common.mustCall(() => {
+ if (--count === 0) {
+ return;
+ }
+ setTimeout(exec, time);
+}, count);
+exec();