1# $Header: /home/fergal/my/cvs/Test-Tester/lib/Test/Tester/CaptureRunner.pm,v 1.3 2003/03/05 01:07:55 fergal Exp $
2use strict;
3
4package Test::Tester::CaptureRunner;
5
6our $VERSION = '1.302199';
7
8
9use Test::Tester::Capture;
10require Exporter;
11
12sub new
13{
14	my $pkg = shift;
15	my $self = bless {}, $pkg;
16	return $self;
17}
18
19sub run_tests
20{
21	my $self = shift;
22
23	my $test = shift;
24
25	capture()->reset;
26
27	$self->{StartLevel} = $Test::Builder::Level;
28	&$test();
29}
30
31sub get_results
32{
33	my $self = shift;
34	my @results = capture()->details;
35
36	my $start = $self->{StartLevel};
37	foreach my $res (@results)
38	{
39		next if defined $res->{depth};
40		my $depth = $res->{_depth} - $res->{_level} - $start - 3;
41#		print "my $depth = $res->{_depth} - $res->{_level} - $start - 1\n";
42		$res->{depth} = $depth;
43	}
44
45	return @results;
46}
47
48sub get_premature
49{
50	return capture()->premature;
51}
52
53sub capture
54{
55	return Test::Tester::Capture->new;
56}
57
58__END__
59
60=head1 NAME
61
62Test::Tester::CaptureRunner - Help testing test modules built with Test::Builder
63
64=head1 DESCRIPTION
65
66This stuff if needed to allow me to play with other ways of monitoring the
67test results.
68
69=head1 AUTHOR
70
71Copyright 2003 by Fergal Daly <fergal@esatclear.ie>.
72
73=head1 LICENSE
74
75Under the same license as Perl itself
76
77See L<https://dev.perl.org/licenses/>
78
79=cut
80