From c6cbf050974c8f6642fa1d7bde309710b66cbfa0 Mon Sep 17 00:00:00 2001 From: Gavin Carr Date: Fri, 16 Mar 2007 11:25:15 +0000 Subject: 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 --- t/Nagios-Plugin-04.t | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 't/Nagios-Plugin-04.t') 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 @@ use strict; #use Test::More 'no_plan'; use Test::More tests=>26; -use Test::Exception; BEGIN { use_ok('Nagios::Plugin') }; use Nagios::Plugin::Functions; Nagios::Plugin::Functions::_fake_exit(1); -lives_ok sub { my $broke = Nagios::Plugin->new(); }, "constructor DOESN'T die without usage"; +eval { Nagios::Plugin->new(); }; +ok(! $@, "constructor DOESN'T die without usage"); my $p = Nagios::Plugin->new(); -dies_ok sub { $p->add_arg('warning', 'warning') }, "add_arg() dies if you haven't instantiated with usage"; -dies_ok sub { $p->getopts }, "getopts() dies if you haven't instantiated with usage"; +eval { $p->add_arg('warning', 'warning') }; +ok($@, "add_arg() dies if you haven't instantiated with usage"); +eval { $p->getopts }; +ok($@, "getopts() dies if you haven't instantiated with usage"); $p = Nagios::Plugin->new( usage => "dummy usage statement" ); @@ -41,7 +43,8 @@ can_ok $p, 'threshold'; #isa_ok $p->threshold, 'Nagios::Plugin::Threshold', "threshold object is defined"; -dies_ok sub { $p->check_threshold() }, "check_threshold dies if called with no args"; +eval { $p->check_threshold() }; +ok($@, "check_threshold dies if called with no args"); # thresholds set implicitly -- cgit v1.2.3-74-g34f1