diff options
author | Gavin Carr <gonzai@users.sourceforge.net> | 2006-10-04 22:02:39 +0000 |
---|---|---|
committer | Gavin Carr <gonzai@users.sourceforge.net> | 2006-10-04 22:02:39 +0000 |
commit | e63887eda6765e1059939ff9c89e4fb244b5819b (patch) | |
tree | 3ae2b11db96535bdbd7a8da60fde642a8fd80619 /t | |
parent | 579fdad51ca7c1d306ba040954864216b0e07050 (diff) | |
download | monitoring-plugin-perl-e63887eda6765e1059939ff9c89e4fb244b5819b.tar.gz |
Fix NP shortname defaulting; downgrade version requirements.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1489 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't')
-rw-r--r-- | t/Nagios-Plugin-01.t | 3 | ||||
-rw-r--r-- | t/Nagios-Plugin-02.t | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/t/Nagios-Plugin-01.t b/t/Nagios-Plugin-01.t index 0ae2113..9de5009 100644 --- a/t/Nagios-Plugin-01.t +++ b/t/Nagios-Plugin-01.t | |||
@@ -1,3 +1,4 @@ | |||
1 | # Nagios::Plugin original test cases | ||
1 | 2 | ||
2 | use strict; | 3 | use strict; |
3 | use Test::More tests => 12; | 4 | use Test::More tests => 12; |
@@ -17,7 +18,7 @@ $p->shortname("PAGESIZE"); | |||
17 | is($p->shortname, "PAGESIZE", "shortname set correctly"); | 18 | is($p->shortname, "PAGESIZE", "shortname set correctly"); |
18 | 19 | ||
19 | $p = Nagios::Plugin->new; | 20 | $p = Nagios::Plugin->new; |
20 | ok(! defined $p->shortname, "shortname should be unset on new"); | 21 | is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new"); |
21 | 22 | ||
22 | $p = Nagios::Plugin->new( shortname => "SIZE" ); | 23 | $p = Nagios::Plugin->new( shortname => "SIZE" ); |
23 | is($p->shortname, "SIZE", "shortname set correctly on new"); | 24 | is($p->shortname, "SIZE", "shortname set correctly on new"); |
diff --git a/t/Nagios-Plugin-02.t b/t/Nagios-Plugin-02.t index 8f25cff..360e180 100644 --- a/t/Nagios-Plugin-02.t +++ b/t/Nagios-Plugin-02.t | |||
@@ -1,6 +1,7 @@ | |||
1 | # Nagios::Plugin test set 2, testing NP::Functions wrapping | ||
1 | 2 | ||
2 | use strict; | 3 | use strict; |
3 | use Test::More tests => 101; | 4 | use Test::More tests => 103; |
4 | 5 | ||
5 | BEGIN { use_ok("Nagios::Plugin") } | 6 | BEGIN { use_ok("Nagios::Plugin") } |
6 | require Nagios::Plugin::Functions; | 7 | require Nagios::Plugin::Functions; |
@@ -146,3 +147,15 @@ for (@ok) { | |||
146 | $_->[1] . '.*' . $_->[2])); | 147 | $_->[1] . '.*' . $_->[2])); |
147 | } | 148 | } |
148 | 149 | ||
150 | |||
151 | # shortname testing | ||
152 | SKIP: { | ||
153 | skip "requires File::Basename", 2 unless eval { require File::Basename }; | ||
154 | $np = Nagios::Plugin->new; | ||
155 | $plugin = uc File::Basename::basename($0); | ||
156 | $plugin =~ s/\..*$//; | ||
157 | is($np->shortname, $plugin, "shortname() is '$plugin'"); | ||
158 | $r = $np->nagios_exit(OK, "foobar"); | ||
159 | like($r->message, qr/^$plugin OK/, "message begins with '$plugin OK'"); | ||
160 | } | ||
161 | |||