1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: RootI.t,v 1.4.2.2 2002/03/11 02:17:39 jason Exp $
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'
use strict;
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 Test;
plan tests => 8;
}
use Bio::Root::Root;
my $obj = new Bio::Root::Root();
ok defined($obj) && $obj->isa('Bio::Root::RootI');
eval { $obj->throw('Testing throw') };
ok $@ =~ /Testing throw/;# 'throw failed';
# doesn't work in perl 5.00405
#my $val;
#eval {
# my ($tfh,$tfile) = $obj->tempfile();
# local * STDERR = $tfh;
# $obj->warn('Testing warn');
# close $tfh;
# open(IN, $tfile) or die("cannot open $tfile");
# $val = join("", <IN>) ;
# close IN;
# unlink $tfile;
#};
#ok $val =~ /Testing warn/;
#'verbose(0) warn did not work properly' . $val;
$obj->verbose(-1);
eval { $obj->throw('Testing throw') };
ok $@=~ /Testing throw/;# 'verbose(-1) throw did not work properly' . $@;
eval { $obj->warn('Testing warn') };
ok !$@;
$obj->verbose(1);
eval { $obj->throw('Testing throw') };
ok $@ =~ /Testing throw/;# 'verbose(1) throw did not work properly' . $@;
# doesn't work in perl 5.00405
#undef $val;
#eval {
# my ($tfh,$tfile) = $obj->tempfile();
# local * STDERR = $tfh;
# $obj->warn('Testing warn');
# close $tfh;
# open(IN, $tfile) or die("cannot open $tfile");
# $val = join("", <IN>);
# close IN;
# unlink $tfile;
#};
#ok $val =~ /Testing warn/;# 'verbose(1) warn did not work properly' . $val;
my @stack = $obj->stack_trace();
ok scalar @stack, 2;
my $verbobj = new Bio::Root::Root(-verbose=>1,-strict=>1);
ok $verbobj->verbose(), 1;
$Bio::Root::Root::DEBUG = 1;
require Bio::SeqIO;
my $seqio = new Bio::SeqIO;
ok($seqio->verbose, 1);
1;
|