[Nagiosplug-checkins] Nagios-Plugin/t Nagios-Plugin-01.t, 1.1, 1.2 Nagios-Plugin-02.t, 1.1, 1.2

Gavin Carr gonzai at users.sourceforge.net
Thu Oct 5 00:02:42 CEST 2006


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

Modified Files:
	Nagios-Plugin-01.t Nagios-Plugin-02.t 
Log Message:
Fix NP shortname defaulting; downgrade version requirements.

Index: Nagios-Plugin-01.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-01.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Nagios-Plugin-01.t	26 Sep 2006 04:11:39 -0000	1.1
+++ Nagios-Plugin-01.t	4 Oct 2006 22:02:39 -0000	1.2
@@ -1,3 +1,4 @@
+# Nagios::Plugin original test cases
 
 use strict;
 use Test::More tests => 12;
@@ -17,7 +18,7 @@
 is($p->shortname, "PAGESIZE", "shortname set correctly");
 
 $p = Nagios::Plugin->new;
-ok(! defined $p->shortname, "shortname should be unset on new");
+is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new");
 
 $p = Nagios::Plugin->new( shortname => "SIZE" );
 is($p->shortname, "SIZE", "shortname set correctly on new");

Index: Nagios-Plugin-02.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-02.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Nagios-Plugin-02.t	26 Sep 2006 04:11:39 -0000	1.1
+++ Nagios-Plugin-02.t	4 Oct 2006 22:02:39 -0000	1.2
@@ -1,6 +1,7 @@
+# Nagios::Plugin test set 2, testing NP::Functions wrapping
 
 use strict;
-use Test::More tests => 101;
+use Test::More tests => 103;
 
 BEGIN { use_ok("Nagios::Plugin") }
 require Nagios::Plugin::Functions;
@@ -146,3 +147,15 @@
             $_->[1] . '.*' . $_->[2]));
 }
 
+
+# shortname testing
+SKIP: {
+    skip "requires File::Basename", 2 unless eval { require File::Basename };
+    $np = Nagios::Plugin->new;
+    $plugin = uc File::Basename::basename($0);
+    $plugin =~ s/\..*$//;
+    is($np->shortname, $plugin, "shortname() is '$plugin'");
+    $r = $np->nagios_exit(OK, "foobar");
+    like($r->message, qr/^$plugin OK/, "message begins with '$plugin OK'");
+}
+





More information about the Commits mailing list