File Coverage

blib/lib/Test/Unit/Runner.pm
Criterion Covered Total %
statement 26 29 89.6
branch 4 6 66.6
condition n/a
subroutine 9 10 90.0
pod 3 7 42.8
total 42 52 80.7


line stmt bran cond sub pod time code
1             package Test::Unit::Runner;
2              
3             =head1 NAME
4              
5             Test::Unit::Runner - abstract base class for test runners
6              
7             =head1 SYNOPSIS
8              
9             my $runner = Test::Unit::TestRunner->new();
10             $runner->filter(@filter_tokens);
11             $runner->start(...);
12              
13             =head1 DESCRIPTION
14              
15             This class is a parent class of all test runners, and hence is not
16             intended to be used directly. It provides functionality such as state
17             (e.g. run-time options) available to all runner classes.
18              
19             =cut
20              
21 2     2   14 use strict;
  2         5  
  2         70  
22              
23 2     2   1586 use Test::Unit::Result;
  2         8  
  2         74  
24              
25 2     2   21 use base qw(Test::Unit::Listener);
  2         3  
  2         1410  
26              
27             sub create_test_result {
28 7     7 0 14 my $self = shift;
29 7         49 return $self->{_result} = Test::Unit::Result->new();
30             }
31              
32 4     4 0 12 sub result { shift->{_result} }
33              
34             sub start_suite {
35 17     17 0 24 my $self = shift;
36 17         26 my ($suite) = @_;
37 17         24 push @{ $self->{_suites_running} }, $suite;
  17         101  
38             }
39              
40             sub end_suite {
41 16     16 0 25 my $self = shift;
42 16         26 my ($suite) = @_;
43 16         22 pop @{ $self->{_suites_running} };
  16         102  
44             }
45              
46             =head2 suites_running()
47              
48             Returns an array stack of the current suites running. When a new
49             suite is started, it is pushed on the stack, and it is popped on
50             completion. Hence the first element in the returned array is
51             the top-level suite, and the last is the innermost suite.
52              
53             =cut
54              
55             sub suites_running {
56 0     0 1 0 my $self = shift;
57 0 0       0 return @{ $self->{_suites_running} || [] };
  0         0  
58             }
59              
60             =head2 filter([ @tokens ])
61              
62             Set the runner's filter tokens to the given list.
63              
64             =cut
65              
66             sub filter {
67 117     117 1 207 my $self = shift;
68 117 100       329 $self->{_filter} = [ @_ ] if @_;
69 117 100       136 return @{ $self->{_filter} || [] };
  117         950  
70             }
71              
72             =head2 reset_filter()
73              
74             Clears the current filter.
75              
76             =cut
77              
78             sub reset_filter {
79 1     1 1 12 my $self = shift;
80 1         4 $self->{_filter} = [];
81             }
82              
83             1;
84              
85             =head1 AUTHOR
86              
87             Copyright (c) 2000-2002, 2005 the PerlUnit Development Team
88             (see L or the F file included in this
89             distribution).
90              
91             All rights reserved. This program is free software; you can
92             redistribute it and/or modify it under the same terms as Perl itself.
93              
94             =head1 SEE ALSO
95              
96             L,
97             L,
98             L
99              
100             =cut