summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Nagios-Plugin-Functions-02.t18
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
3use strict; 3use strict;
4use Test::More tests => 33; 4use Test::More tests => 37;
5 5
6BEGIN { use_ok("Nagios::Plugin::Functions", ":all") } 6BEGIN { 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
160is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}"); 160is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}");
161is($message, 'D E F', "join_all '$join_all' (critical, warning) message is $message"); 161is($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
167ok(! defined eval { ($code, $message) = check_messages() },
168 "check_messages dies without message args");
169
170ok(! defined eval { ($code, $message) = check_messages(warning => $arrays{warning}) },
171 "check_messages dies without 'critical' message");
172
173ok(! defined eval { ($code, $message) = check_messages(critical => $arrays{critical}) },
174 "check_messages dies without 'warning' message");
175
176ok(defined eval { ($code, $message) = check_messages(critical => $arrays{critical}, warning => $arrays{warning}) },
177 "check_messages ok with 'critical' and 'warning' messages");
178