Newer
Older
# Copyright [1999-2013] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
Andy Yates
committed
use Test::More;
use Bio::EnsEMBL::Test::TestUtils;
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
83
84
85
86
87
88
89
90
91
92
93
94
use Bio::EnsEMBL::Utils::Exception qw(warning verbose throw info
deprecate stack_trace_dump stack_trace);
our $verbose= 0;
if(!$verbose) {
verbose('NONE');
}
#
#1 - test throw
#
eval {
throw('test exception');
};
ok($@);
debug($@);
#
#2-4 - Test verbosity, warnings
#
$verbose && verbose('EXCEPTION');
ok(verbose() == 1000 || (!$verbose && verbose() == 0));
warning('This warn should not appear');
ok(1);
warning('This warn should appear', 1000);
ok(1);
info("This info should not appear");
ok(1);
$verbose && verbose('ALL');
info("This info should appear");
ok(1);
#
# 5-6 Test stack trace
#
my $std = stack_trace_dump();
ok($std =~ /[A-Z]/);
debug(stack_trace_dump);
ok(stack_trace());
#
# 7 Test deprecate
#
test_deprecate();
ok(7);
sub test_deprecate {
deprecate('This deprecate warning should appear');
}
verbose('DEPRECATE');
Andy Yates
committed
done_testing();