File Coverage

blib/lib/Test/Unit/Runner.pm
Criterion Covered Total %
statement 27 30 90.0
branch 4 6 66.6
condition n/a
subroutine 10 11 90.9
pod 3 7 42.8
total 44 54 81.4


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