diff options
-rw-r--r-- | Build.PL | 1 | ||||
-rwxr-xr-x | bin/icli | 5 | ||||
-rw-r--r-- | t/50-icli.t | 6 |
3 files changed, 7 insertions, 5 deletions
@@ -17,6 +17,7 @@ my $build = Module::Build->new( requires => { 'perl' => '5.10.0', 'autodie' => 0, + 'Carp' => 0, 'Date::Format' => 0, 'Getopt::Long' => 0, 'Term::ANSIColor' => 0, @@ -7,6 +7,7 @@ use strict; use warnings; use 5.010; +use Carp qw(croak); use Date::Format; use Getopt::Long qw/:config bundling/; use Term::ANSIColor; @@ -364,7 +365,7 @@ sub service_state { when (1) { return with_colour( ' WARNING', 'black on_yellow' ) } when (2) { return with_colour( 'CRITICAL', 'white on_red' ) } when (3) { return with_colour( ' UNKNOWN', 'white on_blue' ) } - default { die("Unknown service state: $digit\n") } + default { croak("Unknown service state: $digit\n") } } } @@ -379,7 +380,7 @@ sub host_state { when (0) { return with_colour( ' OK ', 'black on_green' ) } when (1) { return with_colour( ' DOWN ', 'white on_red' ) } when (2) { return with_colour( 'UNREACHABLE', 'white on_blue' ) } - default { die("Unknown host state: $digit\n") } + default { croak("Unknown host state: $digit\n") } } } diff --git a/t/50-icli.t b/t/50-icli.t index 62d7912..2e6f0c7 100644 --- a/t/50-icli.t +++ b/t/50-icli.t @@ -170,10 +170,10 @@ $icli = "bin/icli -f t/in/status.dat.weird.2 -c t/in/objects.cache"; $cmd = Test::Command->new(cmd => "$icli -lh -h alpha"); $cmd->exit_isnt_num(0); -$cmd->stdout_is_eq('alpha '); -$cmd->stderr_is_eq("Unknown host state: 23\n"); +$cmd->stdout_is_eq($EMPTY); +$cmd->stderr_like(qr{^Unknown host state: 23}s); $cmd = Test::Command->new(cmd => "$icli -ls -h aneurysm"); $cmd->exit_isnt_num(0); $cmd->stdout_is_eq('Disk: / '); -$cmd->stderr_is_eq("Unknown service state: 23\n"); +$cmd->stderr_like(qr{^Unknown service state: 23}s); |