1 # -*-Perl-*- Test Harness script for Bioperl
11 test_begin(-tests => 7,
12 -requires_module => 'Error');
14 use_ok('Bio::Root::TestObject');
18 $Error::Debug = test_debug();
20 # Set up a tester object.
21 ok my $test = Bio::Root::TestObject->new(-verbose => test_debug());
23 is $test->data('Eeny meeny miney moe.'), 'Eeny meeny miney moe.';
25 # This demonstrates what will happen if a method defined in an
26 # interface that is not implemented in the implementating object.
32 catch Bio::Root::NotImplemented with {
34 is ref $err, 'Bio::Root::NotImplemented';
38 # TestObject::bar() deliberately throws a Bio::TestException,
39 # which is defined in TestObject.pm
43 catch Bio::TestException with {
45 is ref $err, 'Bio::TestException';
49 # Use the non-object-oriented syntax to throw a generic Bio::Root::Exception.
51 throw Bio::Root::Exception( "A generic error", 42 );
53 catch Bio::Root::Exception with {
55 is ref $err, 'Bio::Root::Exception';
59 # Try to call a subroutine that doesn't exist. But because it occurs
60 # within a try block, the Error module will create a Error::Simple to
61 # capture it. Handy eh?
68 is ref $err, 'Error::Simple';