summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-04.t
diff options
context:
space:
mode:
authorGavin Carr <gonzai@users.sourceforge.net>2007-03-16 11:25:15 +0000
committerGavin Carr <gonzai@users.sourceforge.net>2007-03-16 11:25:15 +0000
commitc6cbf050974c8f6642fa1d7bde309710b66cbfa0 (patch)
tree0eb0ea62814b0623fb619c2af3287a585de48c2c /t/Nagios-Plugin-04.t
parente5109f99c9657a1a8e9fb32b19254a417e2ccd65 (diff)
downloadmonitoring-plugin-perl-c6cbf050974c8f6642fa1d7bde309710b66cbfa0.tar.gz
Cleanups, mostly to N::P::Range/Threshold/Performance.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1641 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-04.t')
-rw-r--r--t/Nagios-Plugin-04.t13
1 files changed, 8 insertions, 5 deletions
diff --git a/t/Nagios-Plugin-04.t b/t/Nagios-Plugin-04.t
index a110b4c..6f31b56 100644
--- a/t/Nagios-Plugin-04.t
+++ b/t/Nagios-Plugin-04.t
@@ -5,18 +5,20 @@
5use strict; 5use strict;
6#use Test::More 'no_plan'; 6#use Test::More 'no_plan';
7use Test::More tests=>26; 7use Test::More tests=>26;
8use Test::Exception;
9 8
10BEGIN { use_ok('Nagios::Plugin') }; 9BEGIN { use_ok('Nagios::Plugin') };
11use Nagios::Plugin::Functions; 10use Nagios::Plugin::Functions;
12Nagios::Plugin::Functions::_fake_exit(1); 11Nagios::Plugin::Functions::_fake_exit(1);
13 12
14 13
15lives_ok sub { my $broke = Nagios::Plugin->new(); }, "constructor DOESN'T die without usage"; 14eval { Nagios::Plugin->new(); };
15ok(! $@, "constructor DOESN'T die without usage");
16 16
17my $p = Nagios::Plugin->new(); 17my $p = Nagios::Plugin->new();
18dies_ok sub { $p->add_arg('warning', 'warning') }, "add_arg() dies if you haven't instantiated with usage"; 18eval { $p->add_arg('warning', 'warning') };
19dies_ok sub { $p->getopts }, "getopts() dies if you haven't instantiated with usage"; 19ok($@, "add_arg() dies if you haven't instantiated with usage");
20eval { $p->getopts };
21ok($@, "getopts() dies if you haven't instantiated with usage");
20 22
21$p = Nagios::Plugin->new( usage => "dummy usage statement" ); 23$p = Nagios::Plugin->new( usage => "dummy usage statement" );
22 24
@@ -41,7 +43,8 @@ can_ok $p, 'threshold';
41#isa_ok $p->threshold, 'Nagios::Plugin::Threshold', "threshold object is defined"; 43#isa_ok $p->threshold, 'Nagios::Plugin::Threshold', "threshold object is defined";
42 44
43 45
44dies_ok sub { $p->check_threshold() }, "check_threshold dies if called with no args"; 46eval { $p->check_threshold() };
47ok($@, "check_threshold dies if called with no args");
45 48
46 49
47# thresholds set implicitly 50# thresholds set implicitly