mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
4316f4df31
An upcoming custom lint rule will provide slightly more strict enforcement of argument alignment for multiline function calls. Adjust existing code to conform. PR-URL: https://github.com/nodejs/node/pull/8642 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
function doSetTimeout(callback, after) {
|
|
return function() {
|
|
setTimeout(callback, after);
|
|
};
|
|
}
|
|
|
|
assert.throws(doSetTimeout('foo'),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetTimeout({foo: 'bar'}),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetTimeout(),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetTimeout(undefined, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetTimeout(null, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetTimeout(false, 0),
|
|
/"callback" argument must be a function/);
|
|
|
|
|
|
function doSetInterval(callback, after) {
|
|
return function() {
|
|
setInterval(callback, after);
|
|
};
|
|
}
|
|
|
|
assert.throws(doSetInterval('foo'),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetInterval({foo: 'bar'}),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetInterval(),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetInterval(undefined, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetInterval(null, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetInterval(false, 0),
|
|
/"callback" argument must be a function/);
|
|
|
|
|
|
function doSetImmediate(callback, after) {
|
|
return function() {
|
|
setImmediate(callback, after);
|
|
};
|
|
}
|
|
|
|
assert.throws(doSetImmediate('foo'),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetImmediate({foo: 'bar'}),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetImmediate(),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetImmediate(undefined, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetImmediate(null, 0),
|
|
/"callback" argument must be a function/);
|
|
assert.throws(doSetImmediate(false, 0),
|
|
/"callback" argument must be a function/);
|