From d84da4e2ec8569b8ff15356b6881df307c7333ca Mon Sep 17 00:00:00 2001 From: Nathan Vonnahme Date: Fri, 10 Nov 2006 01:26:16 +0000 Subject: * exposed Getopt and Threshold functionality from top level Nagios::Plugin * exchanged Class::Struct for Class::Accessor * POD is not updated yet. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1536 f882894a-f735-0410-b71e-b25c423dba1c --- t/Nagios-Plugin-01.t | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 't/Nagios-Plugin-01.t') 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); diag "\nusing Nagios::Plugin revision ". $Nagios::Plugin::VERSION . "\n" if $ENV{TEST_VERBOSE}; -my $p = Nagios::Plugin->new; +my $p = Nagios::Plugin->new (usage => "dummy usage"); isa_ok( $p, "Nagios::Plugin"); $p->shortname("PAGESIZE"); -is($p->shortname, "PAGESIZE", "shortname set correctly"); +is($p->shortname, "PAGESIZE", "shortname explicitly set correctly"); -$p = Nagios::Plugin->new; +$p = Nagios::Plugin->new (usage => "dummy usage"); is($p->shortname, "NAGIOS-PLUGIN-01", "shortname should default on new"); -$p = Nagios::Plugin->new( shortname => "SIZE" ); +$p = Nagios::Plugin->new( shortname => "SIZE", usage => "dummy usage" ); is($p->shortname, "SIZE", "shortname set correctly on new"); diag "warn if < 10, critical if > 25 " if $ENV{TEST_VERBOSE}; my $t = $p->set_thresholds( warning => "10:25", critical => "~:25" ); +use Data::Dumper; +#diag "dumping p: ". Dumper $p; +#diag "dumping perfdata: ". Dumper $p->perfdata; + + $p->add_perfdata( label => "size", value => 1, @@ -34,6 +39,7 @@ $p->add_perfdata( ); cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); +#diag "dumping perfdata: ". Dumper ($p->perfdata); my $expected = {qw( -1 WARNING -- cgit v1.2.3-74-g34f1