Blame t/kill.t

Packit 6427f8
#!/usr/bin/perl -w
Packit 6427f8
use strict;
Packit 6427f8
use Test::More;
Packit 6427f8
use autodie;
Packit 6427f8
Packit 6427f8
use constant SYSINIT => 1;
Packit 6427f8
Packit 6427f8
if (not CORE::kill(0,$$)) {
Packit 6427f8
    plan skip_all => "Can't send signals to own process on this system.";
Packit 6427f8
}
Packit 6427f8
Packit 6427f8
if (CORE::kill(0, SYSINIT)) {
Packit 6427f8
    plan skip_all => "Can unexpectedly signal process 1. Won't run as root.";
Packit 6427f8
}
Packit 6427f8
Packit 6427f8
plan tests => 4;
Packit 6427f8
Packit 6427f8
eval { kill(0, $$); };
Packit 6427f8
is($@, '', "Signalling self is fine");
Packit 6427f8
Packit 6427f8
eval { kill(0, SYSINIT ) };
Packit 6427f8
isa_ok($@, 'autodie::exception', "Signalling init is not allowed.");
Packit 6427f8
Packit 6427f8
eval { kill(0, $$, SYSINIT) };
Packit 6427f8
isa_ok($@, 'autodie::exception', 'kill exception on single failure.');
Packit 6427f8
is($@->return, 1, "kill fails correctly on a 'true' failure.");