1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 7,
11 -requires_module => 'Error');
13 use_ok('Bio::Root::TestObject');
17 $Error::Debug = test_debug();
19 # Set up a tester object.
20 ok my $test = Bio::Root::TestObject->new(-verbose => test_debug());
22 is $test->data('Eeny meeny miney moe.'), 'Eeny meeny miney moe.';
24 # This demonstrates what will happen if a method defined in an
25 # interface that is not implemented in the implementating object.
31 catch Bio::Root::NotImplemented with {
33 is ref $err, 'Bio::Root::NotImplemented';
37 # TestObject::bar() deliberately throws a Bio::TestException,
38 # which is defined in TestObject.pm
42 catch Bio::TestException with {
44 is ref $err, 'Bio::TestException';
48 # Use the non-object-oriented syntax to throw a generic Bio::Root::Exception.
50 throw Bio::Root::Exception( "A generic error", 42 );
52 catch Bio::Root::Exception with {
54 is ref $err, 'Bio::Root::Exception';
58 # Try to call a subroutine that doesn't exist. But because it occurs
59 # within a try block, the Error module will create a Error::Simple to
60 # capture it. Handy eh?
67 is ref $err, 'Error::Simple';