From 9a8821ee093c1c329fb175e9624652e46da27db3 Mon Sep 17 00:00:00 2001 From: alohaglenn Date: Sat, 22 Apr 2017 10:53:56 -0700 Subject: [PATCH 1/2] test: improve test-process-kill-pid --- test/parallel/test-process-kill-pid.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 4b042de58b9c52..69679124e904d9 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -38,16 +38,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. // From 80bae496aa20e21f9597400dc50be13adc35886e Mon Sep 17 00:00:00 2001 From: alohaglenn Date: Sat, 22 Apr 2017 11:24:31 -0700 Subject: [PATCH 2/2] test: add start and end regex identifiers --- test/parallel/test-process-kill-pid.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 69679124e904d9..3c2d684c4691ed 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -39,19 +39,19 @@ const assert = require('assert'); // process.pid, String(process.pid): ourself assert.throws(function() { process.kill('SIGTERM'); }, - /TypeError: invalid pid/); -assert.throws(function() { process.kill(null); }, /TypeError: invalid pid/); + /^TypeError: invalid pid$/); +assert.throws(function() { process.kill(null); }, /^TypeError: invalid pid$/); assert.throws(function() { process.kill(undefined); }, - /TypeError: invalid pid/); + /^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/); + /^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: Unknown signal: test/); + /^Error: Unknown signal: test$/); // Test kill argument processing in valid cases. //