use strict;
-plan tests => 2;
+plan tests => 5;
ok( kill(0, $$), 'kill(0, $pid) returns true if $pid exists' );
# It is highly unlikely that all of the above PIDs are genuinely in use,
# so $count should be less than $total.
ok( $count < $total, 'kill(0, $pid) returns false if $pid does not exist' );
+
+# Verify that trying to kill a non-numeric PID is fatal
+my @bad_pids = (
+ [ undef , 'undef' ],
+ [ '' , 'empty string' ],
+ [ 'abcd', 'alphabetic' ],
+);
+
+for my $case ( @bad_pids ) {
+ my ($pid, $name) = @$case;
+ eval { kill 0, $pid };
+ like( $@, qr/^Can't kill a non-numeric process ID/, "dies killing $name pid");
+}
+