diff options
author | yorkie <yorkiefixer@gmail.com> | 2015-11-17 02:54:04 +0800 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-11-18 10:52:01 -0500 |
commit | 72e3dd9f43c1d7ad1ea31db9a985901d902a9cfb (patch) | |
tree | fb84c875486202e68932583cdbc94578439824d0 /test | |
parent | 339d3840c88470fdc4a3427542258f6ec4856530 (diff) | |
download | android-node-v8-72e3dd9f43c1d7ad1ea31db9a985901d902a9cfb.tar.gz android-node-v8-72e3dd9f43c1d7ad1ea31db9a985901d902a9cfb.tar.bz2 android-node-v8-72e3dd9f43c1d7ad1ea31db9a985901d902a9cfb.zip |
process: throw on non-function to nextTick()
This commit causes process.nextTick() to throw when its callback
argument is not a function.
PR-URL: https://github.com/nodejs/node/pull/3860
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-next-tick-errors.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js index eccd7a43a0..8e1bc52dec 100644 --- a/test/parallel/test-next-tick-errors.js +++ b/test/parallel/test-next-tick-errors.js @@ -20,6 +20,22 @@ process.nextTick(function() { order.push('C'); }); +function testNextTickWith(val) { + assert.throws( + function() { + process.nextTick(val); + }, + TypeError + ); +} + +testNextTickWith(false); +testNextTickWith(true); +testNextTickWith(1); +testNextTickWith('str'); +testNextTickWith({}); +testNextTickWith([]); + process.on('uncaughtException', function() { if (!exceptionHandled) { exceptionHandled = true; |