[Bioperl-guts-l] bioperl-live/t Exception.t,1.8,1.9
Senduran Balasubramaniam
sendu at dev.open-bio.org
Fri Nov 17 11:01:12 EST 2006
Update of /home/repository/bioperl/bioperl-live/t
In directory dev.open-bio.org:/tmp/cvs-serv16463/t
Modified Files:
Exception.t
Log Message:
moved to Test::More, uses Error.pm in t/lib
Index: Exception.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/Exception.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Exception.t 17 Jul 2006 14:04:22 -0000 1.8
--- Exception.t 17 Nov 2006 16:01:10 -0000 1.9
***************
*** 6,40 ****
# `make test'. After `make install' it should work as `perl test.t'
- my $error;
-
use strict;
! use lib '.';
! use lib './examples/root/lib';
!
! BEGIN {
! # to handle systems with no installed Test module
! # we include the t dir (where a copy of Test.pm is located)
! # as a fallback
! eval { require Test; };
! if( $@ ) {
! use lib 't';
! }
! use vars qw($NTESTS $SKIPERROR);
! $NTESTS = 8;
! $error = 0;
!
! use Test;
! eval { require Error; };
! if( $@ ) {
! $NTESTS = 3;
! $SKIPERROR = 1;
! }
! plan tests => $NTESTS;
}
! if( $error == 1 ) {
! exit(0);
}
--- 6,31 ----
# `make test'. After `make install' it should work as `perl test.t'
use strict;
! use vars qw($NUMTESTS $DEBUG);
! eval {require Test::More;};
! if ($@) {
! use lib 't/lib';
! }
! use Test::More;
! eval {require Error;};
! if ($@) {
! use lib 't/lib';
}
+ use_ok("Error");
! use lib './examples/root/lib';
!
! BEGIN {
! $NUMTESTS = 8;
! $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
!
! plan tests => $NUMTESTS;
}
***************
*** 43,58 ****
use Error qw(:try);
- ok(1);
-
$Error::Debug = 1;
# Set up a tester object.
! my $test = TestObject->new();
!
! ok($test);
!
! ok($test->data('Eeny meeny miney moe.'), 'Eeny meeny miney moe.');
! exit if $SKIPERROR; # bail if we don't have Error installed
# This demonstrates what will happen if a method defined in an
--- 34,43 ----
use Error qw(:try);
$Error::Debug = 1;
# Set up a tester object.
! ok my $test = TestObject->new();
! is $test->data('Eeny meeny miney moe.'), 'Eeny meeny miney moe.';
# This demonstrates what will happen if a method defined in an
***************
*** 61,75 ****
eval {
try {
! $test->foo();
}
catch Bio::Root::NotImplemented with {
! my $err = shift;
! ok(ref $err, 'Bio::Root::NotImplemented');
};
-
};
! if( $@ ) {
! # warn($@);
! }
# TestObject::bar() deliberately throws a Bio::TestException,
# which is defined in TestObject.pm
--- 46,57 ----
eval {
try {
! $test->foo();
}
catch Bio::Root::NotImplemented with {
! my $err = shift;
! is ref $err, 'Bio::Root::NotImplemented';
};
};
!
# TestObject::bar() deliberately throws a Bio::TestException,
# which is defined in TestObject.pm
***************
*** 79,83 ****
catch Bio::TestException with {
my $err = shift;
! ok(ref $err, 'Bio::TestException');
};
--- 61,65 ----
catch Bio::TestException with {
my $err = shift;
! is ref $err, 'Bio::TestException';
};
***************
*** 89,94 ****
catch Bio::Root::Exception with {
my $err = shift;
! ok(ref $err, 'Bio::Root::Exception');
! ok($err->value, 42);
};
--- 71,76 ----
catch Bio::Root::Exception with {
my $err = shift;
! is ref $err, 'Bio::Root::Exception';
! is $err->value, 42;
};
***************
*** 97,110 ****
# capture it. Handy eh?
! if( $] >= 5.006001 ) {
! try {
$test->foobar();
- }
- otherwise {
- my $err = shift;
- ok(ref $err, 'Error::Simple');
- };
- } else {
- skip("Can't run this test on perl < 5.6.1",1);
}
--- 79,88 ----
# capture it. Handy eh?
! try {
$test->foobar();
}
+ otherwise {
+ my $err = shift;
+ is ref $err, 'Error::Simple';
+ };
More information about the Bioperl-guts-l
mailing list