summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-01.t
diff options
context:
space:
mode:
Diffstat (limited to 't/Nagios-Plugin-01.t')
-rw-r--r--t/Nagios-Plugin-01.t14
1 files changed, 10 insertions, 4 deletions
diff --git a/t/Nagios-Plugin-01.t b/t/Nagios-Plugin-01.t
index 9de5009..a73fce4 100644
--- a/t/Nagios-Plugin-01.t
+++ b/t/Nagios-Plugin-01.t
@@ -11,21 +11,26 @@ Nagios::Plugin::Functions::_fake_exit(1);
11diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n" 11diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n"
12 if $ENV{TEST_VERBOSE}; 12 if $ENV{TEST_VERBOSE};
13 13
14my $p = Nagios::Plugin->new; 14my $p = Nagios::Plugin->new (usage => "dummy usage");
15isa_ok( $p, "Nagios::Plugin"); 15isa_ok( $p, "Nagios::Plugin");
16 16
17$p->shortname("PAGESIZE"); 17$p->shortname("PAGESIZE");
18is($p->shortname, "PAGESIZE", "shortname set correctly"); 18is($p->shortname, "PAGESIZE", "shortname explicitly set correctly");
19 19
20$p = Nagios::Plugin->new; 20$p = Nagios::Plugin->new (usage => "dummy usage");
21is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new"); 21is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new");
22 22
23$p = Nagios::Plugin->new( shortname => "SIZE" ); 23$p = Nagios::Plugin->new( shortname => "SIZE", usage => "dummy usage" );
24is($p->shortname, "SIZE", "shortname set correctly on new"); 24is($p->shortname, "SIZE", "shortname set correctly on new");
25 25
26diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE}; 26diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE};
27my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" ); 27my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" );
28 28
29use Data::Dumper;
30#diag "dumping p: ". Dumper $p;
31#diag "dumping perfdata: ". Dumper $p->perfdata;
32
33
29$p->add_perfdata( 34$p->add_perfdata(
30 label => "size", 35 label => "size",
31 value => 1, 36 value => 1,
@@ -34,6 +39,7 @@ $p->add_perfdata(
34 ); 39 );
35 40
36cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); 41cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct");
42#diag "dumping perfdata: ". Dumper ($p->perfdata);
37 43
38my $expected = {qw( 44my $expected = {qw(
39 -1 WARNING 45 -1 WARNING