diff options
Diffstat (limited to 't')
-rw-r--r-- | t/Nagios-Plugin-Functions-02.t | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/t/Nagios-Plugin-Functions-02.t b/t/Nagios-Plugin-Functions-02.t index 981e2eb..1a9351b 100644 --- a/t/Nagios-Plugin-Functions-02.t +++ b/t/Nagios-Plugin-Functions-02.t | |||
@@ -1,7 +1,7 @@ | |||
1 | # check_messages tests | 1 | # check_messages tests |
2 | 2 | ||
3 | use strict; | 3 | use strict; |
4 | use Test::More tests => 33; | 4 | use Test::More tests => 37; |
5 | 5 | ||
6 | BEGIN { use_ok("Nagios::Plugin::Functions", ":all") } | 6 | BEGIN { use_ok("Nagios::Plugin::Functions", ":all") } |
7 | 7 | ||
@@ -160,3 +160,19 @@ is($message, $msg_all_wo, "join_all '$join_all' (critical, warning, \$ok) messag | |||
160 | is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}"); | 160 | is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}"); |
161 | is($message, 'D E F', "join_all '$join_all' (critical, warning) message is $message"); | 161 | is($message, 'D E F', "join_all '$join_all' (critical, warning) message is $message"); |
162 | 162 | ||
163 | # ------------------------------------------------------------------------- | ||
164 | # Error cases | ||
165 | |||
166 | # Test failures without required fields | ||
167 | ok(! defined eval { ($code, $message) = check_messages() }, | ||
168 | "check_messages dies without message args"); | ||
169 | |||
170 | ok(! defined eval { ($code, $message) = check_messages(warning => $arrays{warning}) }, | ||
171 | "check_messages dies without 'critical' message"); | ||
172 | |||
173 | ok(! defined eval { ($code, $message) = check_messages(critical => $arrays{critical}) }, | ||
174 | "check_messages dies without 'warning' message"); | ||
175 | |||
176 | ok(defined eval { ($code, $message) = check_messages(critical => $arrays{critical}, warning => $arrays{warning}) }, | ||
177 | "check_messages ok with 'critical' and 'warning' messages"); | ||
178 | |||