0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-timers-throw-when-cb-not-function.js
Rich Trott 4316f4df31 test,lib: align arguments in multiline calls
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>
2016-09-20 10:22:23 -07:00

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/);