~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/RootI.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*-
2
 
## Bioperl Test Harness Script for Modules
3
 
## $Id: RootI.t,v 1.8 2006/07/12 18:46:22 sac Exp $
4
 
 
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'
7
 
 
8
 
use strict;
9
 
 
10
 
BEGIN {
11
 
    # to handle systems with no installed Test module
12
 
    # we include the t dir (where a copy of Test.pm is located)
13
 
    # as a fallback
14
 
    eval { require Test; };
15
 
    if( $@ ) {
16
 
        use lib 't';
17
 
    }
18
 
    use Test;    
19
 
    plan tests => 11;
20
 
}
21
 
 
22
 
 
23
 
use Bio::Root::Root;
24
 
 
25
 
my $obj = new Bio::Root::Root();
26
 
ok defined($obj) && $obj->isa('Bio::Root::RootI');
27
 
 
28
 
eval { $obj->throw('Testing throw') };
29
 
ok $@ =~ /Testing throw/;# 'throw failed';
30
 
 
31
 
# doesn't work in perl 5.00405
32
 
#my $val;
33
 
#eval {
34
 
#    my ($tfh,$tfile) = $obj->tempfile();
35
 
#    local * STDERR = $tfh;
36
 
#    $obj->warn('Testing warn');
37
 
#    close $tfh;    
38
 
#    open(IN, $tfile) or die("cannot open $tfile");    
39
 
#    $val = join("", <IN>) ;
40
 
#    close IN;
41
 
#    unlink $tfile;
42
 
#};
43
 
#ok $val =~ /Testing warn/;
44
 
#'verbose(0) warn did not work properly' . $val;
45
 
 
46
 
$obj->verbose(-1);
47
 
eval { $obj->throw('Testing throw') };
48
 
ok $@=~ /Testing throw/;# 'verbose(-1) throw did not work properly' . $@;
49
 
 
50
 
eval { $obj->warn('Testing warn') };
51
 
ok !$@;
52
 
 
53
 
$obj->verbose(1);
54
 
eval { $obj->throw('Testing throw') };
55
 
ok $@ =~ /Testing throw/;# 'verbose(1) throw did not work properly' . $@;
56
 
 
57
 
# doesn't work in perl 5.00405
58
 
#undef $val;
59
 
#eval {
60
 
#    my ($tfh,$tfile) = $obj->tempfile();
61
 
#    local * STDERR = $tfh;
62
 
#    $obj->warn('Testing warn');
63
 
#    close $tfh;
64
 
#    open(IN, $tfile) or die("cannot open $tfile");    
65
 
#    $val = join("", <IN>);
66
 
#    close IN;
67
 
#    unlink $tfile;
68
 
#};
69
 
#ok $val =~ /Testing warn/;# 'verbose(1) warn did not work properly' . $val;
70
 
 
71
 
my @stack = $obj->stack_trace();
72
 
ok scalar @stack, 2;
73
 
 
74
 
my $verbobj = new Bio::Root::Root(-verbose=>1,-strict=>1);
75
 
ok $verbobj->verbose(), 1;
76
 
 
77
 
$Bio::Root::Root::DEBUG = 1;
78
 
require Bio::Seq;
79
 
my $seq = new Bio::Seq;
80
 
ok($seq->verbose, 1);
81
 
 
82
 
# test for bug #1343
83
 
my @vals = Bio::Root::RootI->_rearrange([qw(apples pears)], 
84
 
                                        -apples => 'up the',
85
 
                                        -pears  => 'stairs');
86
 
eval { $obj->throw_not_implemented() };
87
 
ok $@ =~ /Bio::Root::NotImplemented/;
88
 
 
89
 
ok(shift @vals, 'up the');
90
 
ok(shift @vals, 'stairs');
91
 
 
92
 
1;
93
 
 
94