2 ## Bioperl Test Harness Script for Modules
5 # Before `make install' is performed this script should be runnable with
6 # `make test'. After `make install' it should work as `perl test.t'
11 # to handle systems with no installed Test module
12 # we include the t dir (where a copy of Test.pm is located)
14 eval { require Test; };
27 my $obj = new Bio::Root::IO();
28 ok defined($obj) && $obj->isa('Bio::Root::IO');
30 eval { $obj->throw('Testing throw') };
31 ok $@ =~ /Testing throw/;# 'throw failed';
34 eval { $obj->throw('Testing throw') };
35 ok $@=~ /Testing throw/;# 'verbose(-1) throw did not work properly' . $@;
37 eval { $obj->warn('Testing warn') };
41 eval { $obj->throw('Testing throw') };
42 ok $@ =~ /Testing throw/;# 'verbose(1) throw did not work properly' . $@;
44 my @stack = $obj->stack_trace();
47 my $verbobj = new Bio::Root::IO(-verbose=>1,-strict=>1);
48 ok $verbobj->verbose(), 1;
52 #############################################
53 # <tests for handle read and write abilities>
54 #############################################
55 my($handle,$file) = $obj->tempfile;
57 ok open(I,"t/data/test.waba");
64 ok $rio = Bio::Root::IO->new(-file=>"t/data/test.waba");
65 ok $wio = Bio::Root::IO->new(-file=>">$file");
72 ok $rio = Bio::Root::IO->new(-fh=>\*I);
73 ok $wio = Bio::Root::IO->new(-fh=>\*O);
77 ##############################################
78 # </tests for handle read and write abilities>
79 ##############################################
81 ##############################################
82 # <tests _pushback for multi-line buffering>
83 ##############################################
85 my $line1 = $rio->_readline;
86 my $line2 = $rio->_readline;
88 ok $rio->_pushback($line1);
89 ok $rio->_pushback($line2);
91 my $line3 = $rio->_readline;
92 my $line4 = $rio->_readline;
93 my $line5 = $rio->_readline;
99 ##############################################
100 # </tests _pushback for multi-line buffering>
101 ##############################################