-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: check for error on invalid signal #10026
test: check for error on invalid signal #10026
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. CI: https://ci.nodejs.org/job/node-test-pull-request/5072/ (currently queued)
@@ -24,6 +24,10 @@ 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); | |||
|
|||
//Test that kill throws an error for invalid signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put a space before this comment, e.g. // Test...
? :D
Asserts that an error should be thrown when an invalid signal is passed to process.kill
a82c7e2
to
5fdea9d
Compare
@@ -24,6 +24,10 @@ 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); | |||
|
|||
// Test that kill throws an error for invalid signal | |||
|
|||
assert.throws(function() { process.kill(1, 'test'); }, Error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok but passing a regexp as the second argument would be better.
assert.throws(() => {
process.kill(1, 'test');
}, /^Error: Unknown signal: test$/);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with @jasnell's suggestion.
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: nodejs#10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Landed in 6aacef7. I agree with the nit about using a RegExp rather than a constructor for |
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Asserts that an error should be thrown when an invalid signal is passed to process.kill(). PR-URL: #10026 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
Asserts that an error should be thrown when an invalid signal is passed to process.kill