[Nagiosplug-checkins] Nagios-Plugin/t Nagios-Plugin-01.t, 1.3, 1.4 Nagios-Plugin-02.t, 1.3, 1.4 Nagios-Plugin-03.t, 1.2, 1.3

Nathan Vonnahme n8v at users.sourceforge.net
Wed Nov 15 03:11:12 CET 2006


Update of /cvsroot/nagiosplug/Nagios-Plugin/t
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28417/t

Modified Files:
	Nagios-Plugin-01.t Nagios-Plugin-02.t Nagios-Plugin-03.t 
Log Message:
made 'usage' unmandatory in N::P::new().



Index: Nagios-Plugin-01.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-01.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Nagios-Plugin-01.t	10 Nov 2006 01:26:16 -0000	1.3
+++ Nagios-Plugin-01.t	15 Nov 2006 02:11:10 -0000	1.4
@@ -11,16 +11,16 @@
 diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n"
   if $ENV{TEST_VERBOSE};
 
-my $p = Nagios::Plugin->new (usage => "dummy usage");
+my $p = Nagios::Plugin->new();
 isa_ok( $p, "Nagios::Plugin");
 
 $p->shortname("PAGESIZE");
 is($p->shortname, "PAGESIZE", "shortname explicitly set correctly");
 
-$p = Nagios::Plugin->new (usage => "dummy usage");
+$p = Nagios::Plugin->new();
 is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new");
 
-$p = Nagios::Plugin->new( shortname => "SIZE", usage => "dummy usage" );
+$p = Nagios::Plugin->new( shortname => "SIZE", () );
 is($p->shortname, "SIZE", "shortname set correctly on new");
 
 diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE};

Index: Nagios-Plugin-03.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-03.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Nagios-Plugin-03.t	10 Nov 2006 01:26:16 -0000	1.2
+++ Nagios-Plugin-03.t	15 Nov 2006 02:11:10 -0000	1.3
@@ -10,7 +10,7 @@
 Nagios::Plugin::Functions::_fake_exit(1);
 
 my $plugin = 'NP_CHECK_MESSAGES_03';
-my $np = Nagios::Plugin->new( shortname => $plugin, usage => "dummy usage" );
+my $np = Nagios::Plugin->new( shortname => $plugin, () );
 is($np->shortname, $plugin, "shortname() is $plugin"); 
 
 my ($code, $message);
@@ -172,33 +172,33 @@
 # add_messages
 
 # Constant codes
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( CRITICAL, "A B C" );
 $np->add_message( WARNING, "D E F" );
 ($code, $message) = $np->check_messages();
 is($code, CRITICAL, "(CRITICAL, WARNING) code is $STATUS_TEXT{$code}");
 is($message, $messages{critical}, "(CRITICAL, WARNING) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( CRITICAL, "A B C" );
 ($code, $message) = $np->check_messages();
 is($code, CRITICAL, "(CRITICAL) code is $STATUS_TEXT{$code}");
 is($message, $messages{critical}, "(CRITICAL) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( WARNING, "D E F" );
 ($code, $message) = $np->check_messages();
 is($code, WARNING, "(WARNING) code is $STATUS_TEXT{$code}");
 is($message, $messages{warning}, "(WARNING) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( WARNING, "D E F" );
 $np->add_message( OK, "G H I" );
 ($code, $message) = $np->check_messages();
 is($code, WARNING, "(WARNING, OK) code is $STATUS_TEXT{$code}");
 is($message, $messages{warning}, "(WARNING, OK) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( OK, "G H I" );
 ($code, $message) = $np->check_messages();
 is($code, OK, "(OK) code is $STATUS_TEXT{$code}");
@@ -206,33 +206,33 @@
 
 
 # String codes
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( critical => "A B C" );
 $np->add_message( warning => "D E F" );
 ($code, $message) = $np->check_messages();
 is($code, CRITICAL, "(critical, warning) code is $STATUS_TEXT{$code}");
 is($message, $messages{critical}, "(critical, warning) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( critical => "A B C" );
 ($code, $message) = $np->check_messages();
 is($code, CRITICAL, "(critical) code is $STATUS_TEXT{$code}");
 is($message, $messages{critical}, "(critical) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( warning => "D E F" );
 ($code, $message) = $np->check_messages();
 is($code, WARNING, "(warning) code is $STATUS_TEXT{$code}");
 is($message, $messages{warning}, "(warning) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( warning => "D E F" );
 $np->add_message( ok => "G H I" );
 ($code, $message) = $np->check_messages();
 is($code, WARNING, "(warning, ok) code is $STATUS_TEXT{$code}");
 is($message, $messages{warning}, "(warning, ok) message is $message");
 
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 $np->add_message( ok => "G H I" );
 ($code, $message) = $np->check_messages();
 is($code, OK, "(ok) code is $STATUS_TEXT{$code}");
@@ -240,7 +240,7 @@
 
 
 # No add_message
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 ($code, $message) = $np->check_messages();
 is($code, OK, "() code is $STATUS_TEXT{$code}");
 is($message, '', "() message is ''");
@@ -250,7 +250,7 @@
 # Error conditions
 
 # add_message errors
-$np = Nagios::Plugin->new (usage => "dummy usage");
+$np = Nagios::Plugin->new();
 ok(! defined eval { $np->add_message( foobar => 'hi mum' ) }, 
     'add_message dies on invalid code');
 ok(! defined eval { $np->add_message( OKAY => 'hi mum' ) }, 

Index: Nagios-Plugin-02.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-02.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Nagios-Plugin-02.t	10 Nov 2006 01:26:16 -0000	1.3
+++ Nagios-Plugin-02.t	15 Nov 2006 02:11:10 -0000	1.4
@@ -16,7 +16,7 @@
 is(DEPENDENT,   $ERRORS{DEPENDENT},     "DEPENDENT => $ERRORS{DEPENDENT}");
 
 my $plugin = 'TEST_PLUGIN';
-my $np = Nagios::Plugin->new( shortname => $plugin, usage => "dummy usage" );
+my $np = Nagios::Plugin->new( shortname => $plugin );
 is($np->shortname, $plugin, "shortname() is $plugin"); 
 
 # Test nagios_exit( CONSTANT, $msg ), nagios_exit( $string, $msg )
@@ -151,7 +151,7 @@
 # shortname testing
 SKIP: {
     skip "requires File::Basename", 2 unless eval { require File::Basename };
-    $np = Nagios::Plugin->new (usage => "dummy usage", version => "1");
+    $np = Nagios::Plugin->new( version => "1");
     $plugin = uc File::Basename::basename($0);
     $plugin =~ s/\..*$//;
     is($np->shortname, $plugin, "shortname() is '$plugin'");





More information about the Commits mailing list