Skip to content

Commit

Permalink
test: improve test-process-kill-pid
Browse files Browse the repository at this point in the history
PR-URL: #12588
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
  • Loading branch information
QueueHefner authored and gibfahn committed May 15, 2017
1 parent ac825fc commit cb63808
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/parallel/test-process-kill-pid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ const assert = require('assert');
//
// process.pid, String(process.pid): ourself

assert.throws(function() { process.kill('SIGTERM'); }, TypeError);
assert.throws(function() { process.kill(null); }, TypeError);
assert.throws(function() { process.kill(undefined); }, TypeError);
assert.throws(function() { process.kill(+'not a number'); }, TypeError);
assert.throws(function() { process.kill(1 / 0); }, TypeError);
assert.throws(function() { process.kill(-1 / 0); }, TypeError);
assert.throws(function() { process.kill('SIGTERM'); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(null); }, /^TypeError: invalid pid$/);
assert.throws(function() { process.kill(undefined); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(+'not a number'); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(1 / 0); }, /^TypeError: invalid pid$/);
assert.throws(function() { process.kill(-1 / 0); }, /^TypeError: invalid pid$/);

// Test that kill throws an error for invalid signal

assert.throws(function() { process.kill(1, 'test'); }, Error);
assert.throws(function() { process.kill(1, 'test'); },
/^Error: Unknown signal: test$/);

// Test kill argument processing in valid cases.
//
Expand Down

0 comments on commit cb63808

Please sign in to comment.