summaryrefslogtreecommitdiff
path: root/test/pummel/test-timers.js
diff options
context:
space:
mode:
authorGibson Fahnestock <gib@uk.ibm.com>2017-01-08 13:19:00 +0000
committerGibson Fahnestock <gib@uk.ibm.com>2017-01-11 11:43:52 +0000
commit7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f (patch)
treea971102d320e17e6cb3d00c48fe708b2b86c8136 /test/pummel/test-timers.js
parent1ef401ce92d6195878b9d041cc969612628f5852 (diff)
downloadandroid-node-v8-7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f.tar.gz
android-node-v8-7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f.tar.bz2
android-node-v8-7a0e462f9facfff8ccd7b37eb5b65db1c2b2f55f.zip
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'test/pummel/test-timers.js')
-rw-r--r--test/pummel/test-timers.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js
index 83a8eeffeb..4555582371 100644
--- a/test/pummel/test-timers.js
+++ b/test/pummel/test-timers.js
@@ -2,20 +2,20 @@
const common = require('../common');
const assert = require('assert');
-var WINDOW = 200; // why is does this need to be so big?
+const WINDOW = 200; // why is does this need to be so big?
-var interval_count = 0;
+let interval_count = 0;
// check that these don't blow up.
clearTimeout(null);
clearInterval(null);
assert.equal(true, setTimeout instanceof Function);
-var starttime = new Date();
+const starttime = new Date();
setTimeout(common.mustCall(function() {
- var endtime = new Date();
+ const endtime = new Date();
- var diff = endtime - starttime;
+ const diff = endtime - starttime;
assert.ok(diff > 0);
console.error('diff: ' + diff);
@@ -23,18 +23,18 @@ setTimeout(common.mustCall(function() {
}), 1000);
// this timer shouldn't execute
-var id = setTimeout(function() { assert.equal(true, false); }, 500);
+const id = setTimeout(function() { assert.equal(true, false); }, 500);
clearTimeout(id);
setInterval(function() {
interval_count += 1;
- var endtime = new Date();
+ const endtime = new Date();
- var diff = endtime - starttime;
+ const diff = endtime - starttime;
assert.ok(diff > 0);
console.error('diff: ' + diff);
- var t = interval_count * 1000;
+ const t = interval_count * 1000;
assert.equal(true, t - WINDOW < diff && diff < t + WINDOW);
@@ -49,7 +49,7 @@ setTimeout(function(param) {
assert.equal('test param', param);
}, 1000, 'test param');
-var interval_count2 = 0;
+let interval_count2 = 0;
setInterval(function(param) {
++interval_count2;
assert.equal('test param', param);
@@ -65,7 +65,7 @@ setTimeout(function(param1, param2) {
assert.equal('param2', param2);
}, 1000, 'param1', 'param2');
-var interval_count3 = 0;
+let interval_count3 = 0;
setInterval(function(param1, param2) {
++interval_count3;
assert.equal('param1', param1);
@@ -76,14 +76,14 @@ setInterval(function(param1, param2) {
}, 1000, 'param1', 'param2');
// setInterval(cb, 0) should be called multiple times.
-var count4 = 0;
-var interval4 = setInterval(function() {
+let count4 = 0;
+const interval4 = setInterval(function() {
if (++count4 > 10) clearInterval(interval4);
}, 0);
// we should be able to clearTimeout multiple times without breakage.
-var expectedTimeouts = 3;
+let expectedTimeouts = 3;
function t() {
expectedTimeouts--;
@@ -91,7 +91,7 @@ function t() {
setTimeout(t, 200);
setTimeout(t, 200);
-var y = setTimeout(t, 200);
+const y = setTimeout(t, 200);
clearTimeout(y);
setTimeout(t, 200);