summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-03.t
diff options
context:
space:
mode:
authorNathan Vonnahme <n8v@users.sourceforge.net>2006-11-15 02:11:10 +0000
committerNathan Vonnahme <n8v@users.sourceforge.net>2006-11-15 02:11:10 +0000
commit22509ac75b3ae04f35b22c87bbd85c643bb1db2b (patch)
tree8423e25fd60ca9c275aa890817b96ae9d50d168f /t/Nagios-Plugin-03.t
parent79b36b4d71afeb016a3b4764b6b484754323b011 (diff)
downloadmonitoring-plugin-perl-22509ac75b3ae04f35b22c87bbd85c643bb1db2b.tar.gz
made 'usage' unmandatory in N::P::new().
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1538 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-03.t')
-rw-r--r--t/Nagios-Plugin-03.t26
1 files changed, 13 insertions, 13 deletions
diff --git a/t/Nagios-Plugin-03.t b/t/Nagios-Plugin-03.t
index 0b7b8af..bc4f5e3 100644
--- a/t/Nagios-Plugin-03.t
+++ b/t/Nagios-Plugin-03.t
@@ -10,7 +10,7 @@ BEGIN {
10Nagios::Plugin::Functions::_fake_exit(1); 10Nagios::Plugin::Functions::_fake_exit(1);
11 11
12my $plugin = 'NP_CHECK_MESSAGES_03'; 12my $plugin = 'NP_CHECK_MESSAGES_03';
13my $np = Nagios::Plugin->new( shortname => $plugin, usage => "dummy usage" ); 13my $np = Nagios::Plugin->new( shortname => $plugin, () );
14is($np->shortname, $plugin, "shortname() is $plugin"); 14is($np->shortname, $plugin, "shortname() is $plugin");
15 15
16my ($code, $message); 16my ($code, $message);
@@ -172,33 +172,33 @@ is($message, 'D E F', "join_all '$join_all' (critical, warning) message is $mess
172# add_messages 172# add_messages
173 173
174# Constant codes 174# Constant codes
175$np = Nagios::Plugin->new (usage => "dummy usage"); 175$np = Nagios::Plugin->new();
176$np->add_message( CRITICAL, "A B C" ); 176$np->add_message( CRITICAL, "A B C" );
177$np->add_message( WARNING, "D E F" ); 177$np->add_message( WARNING, "D E F" );
178($code, $message) = $np->check_messages(); 178($code, $message) = $np->check_messages();
179is($code, CRITICAL, "(CRITICAL, WARNING) code is $STATUS_TEXT{$code}"); 179is($code, CRITICAL, "(CRITICAL, WARNING) code is $STATUS_TEXT{$code}");
180is($message, $messages{critical}, "(CRITICAL, WARNING) message is $message"); 180is($message, $messages{critical}, "(CRITICAL, WARNING) message is $message");
181 181
182$np = Nagios::Plugin->new (usage => "dummy usage"); 182$np = Nagios::Plugin->new();
183$np->add_message( CRITICAL, "A B C" ); 183$np->add_message( CRITICAL, "A B C" );
184($code, $message) = $np->check_messages(); 184($code, $message) = $np->check_messages();
185is($code, CRITICAL, "(CRITICAL) code is $STATUS_TEXT{$code}"); 185is($code, CRITICAL, "(CRITICAL) code is $STATUS_TEXT{$code}");
186is($message, $messages{critical}, "(CRITICAL) message is $message"); 186is($message, $messages{critical}, "(CRITICAL) message is $message");
187 187
188$np = Nagios::Plugin->new (usage => "dummy usage"); 188$np = Nagios::Plugin->new();
189$np->add_message( WARNING, "D E F" ); 189$np->add_message( WARNING, "D E F" );
190($code, $message) = $np->check_messages(); 190($code, $message) = $np->check_messages();
191is($code, WARNING, "(WARNING) code is $STATUS_TEXT{$code}"); 191is($code, WARNING, "(WARNING) code is $STATUS_TEXT{$code}");
192is($message, $messages{warning}, "(WARNING) message is $message"); 192is($message, $messages{warning}, "(WARNING) message is $message");
193 193
194$np = Nagios::Plugin->new (usage => "dummy usage"); 194$np = Nagios::Plugin->new();
195$np->add_message( WARNING, "D E F" ); 195$np->add_message( WARNING, "D E F" );
196$np->add_message( OK, "G H I" ); 196$np->add_message( OK, "G H I" );
197($code, $message) = $np->check_messages(); 197($code, $message) = $np->check_messages();
198is($code, WARNING, "(WARNING, OK) code is $STATUS_TEXT{$code}"); 198is($code, WARNING, "(WARNING, OK) code is $STATUS_TEXT{$code}");
199is($message, $messages{warning}, "(WARNING, OK) message is $message"); 199is($message, $messages{warning}, "(WARNING, OK) message is $message");
200 200
201$np = Nagios::Plugin->new (usage => "dummy usage"); 201$np = Nagios::Plugin->new();
202$np->add_message( OK, "G H I" ); 202$np->add_message( OK, "G H I" );
203($code, $message) = $np->check_messages(); 203($code, $message) = $np->check_messages();
204is($code, OK, "(OK) code is $STATUS_TEXT{$code}"); 204is($code, OK, "(OK) code is $STATUS_TEXT{$code}");
@@ -206,33 +206,33 @@ is($message, $messages{ok}, "(OK) message is $message");
206 206
207 207
208# String codes 208# String codes
209$np = Nagios::Plugin->new (usage => "dummy usage"); 209$np = Nagios::Plugin->new();
210$np->add_message( critical => "A B C" ); 210$np->add_message( critical => "A B C" );
211$np->add_message( warning => "D E F" ); 211$np->add_message( warning => "D E F" );
212($code, $message) = $np->check_messages(); 212($code, $message) = $np->check_messages();
213is($code, CRITICAL, "(critical, warning) code is $STATUS_TEXT{$code}"); 213is($code, CRITICAL, "(critical, warning) code is $STATUS_TEXT{$code}");
214is($message, $messages{critical}, "(critical, warning) message is $message"); 214is($message, $messages{critical}, "(critical, warning) message is $message");
215 215
216$np = Nagios::Plugin->new (usage => "dummy usage"); 216$np = Nagios::Plugin->new();
217$np->add_message( critical => "A B C" ); 217$np->add_message( critical => "A B C" );
218($code, $message) = $np->check_messages(); 218($code, $message) = $np->check_messages();
219is($code, CRITICAL, "(critical) code is $STATUS_TEXT{$code}"); 219is($code, CRITICAL, "(critical) code is $STATUS_TEXT{$code}");
220is($message, $messages{critical}, "(critical) message is $message"); 220is($message, $messages{critical}, "(critical) message is $message");
221 221
222$np = Nagios::Plugin->new (usage => "dummy usage"); 222$np = Nagios::Plugin->new();
223$np->add_message( warning => "D E F" ); 223$np->add_message( warning => "D E F" );
224($code, $message) = $np->check_messages(); 224($code, $message) = $np->check_messages();
225is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}"); 225is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}");
226is($message, $messages{warning}, "(warning) message is $message"); 226is($message, $messages{warning}, "(warning) message is $message");
227 227
228$np = Nagios::Plugin->new (usage => "dummy usage"); 228$np = Nagios::Plugin->new();
229$np->add_message( warning => "D E F" ); 229$np->add_message( warning => "D E F" );
230$np->add_message( ok => "G H I" ); 230$np->add_message( ok => "G H I" );
231($code, $message) = $np->check_messages(); 231($code, $message) = $np->check_messages();
232is($code, WARNING, "(warning, ok) code is $STATUS_TEXT{$code}"); 232is($code, WARNING, "(warning, ok) code is $STATUS_TEXT{$code}");
233is($message, $messages{warning}, "(warning, ok) message is $message"); 233is($message, $messages{warning}, "(warning, ok) message is $message");
234 234
235$np = Nagios::Plugin->new (usage => "dummy usage"); 235$np = Nagios::Plugin->new();
236$np->add_message( ok => "G H I" ); 236$np->add_message( ok => "G H I" );
237($code, $message) = $np->check_messages(); 237($code, $message) = $np->check_messages();
238is($code, OK, "(ok) code is $STATUS_TEXT{$code}"); 238is($code, OK, "(ok) code is $STATUS_TEXT{$code}");
@@ -240,7 +240,7 @@ is($message, $messages{ok}, "(ok) message is $message");
240 240
241 241
242# No add_message 242# No add_message
243$np = Nagios::Plugin->new (usage => "dummy usage"); 243$np = Nagios::Plugin->new();
244($code, $message) = $np->check_messages(); 244($code, $message) = $np->check_messages();
245is($code, OK, "() code is $STATUS_TEXT{$code}"); 245is($code, OK, "() code is $STATUS_TEXT{$code}");
246is($message, '', "() message is ''"); 246is($message, '', "() message is ''");
@@ -250,7 +250,7 @@ is($message, '', "() message is ''");
250# Error conditions 250# Error conditions
251 251
252# add_message errors 252# add_message errors
253$np = Nagios::Plugin->new (usage => "dummy usage"); 253$np = Nagios::Plugin->new();
254ok(! defined eval { $np->add_message( foobar => 'hi mum' ) }, 254ok(! defined eval { $np->add_message( foobar => 'hi mum' ) },
255 'add_message dies on invalid code'); 255 'add_message dies on invalid code');
256ok(! defined eval { $np->add_message( OKAY => 'hi mum' ) }, 256ok(! defined eval { $np->add_message( OKAY => 'hi mum' ) },