diff options
author | Norbert Preining <preining@logic.at> | 2010-05-12 16:54:37 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-05-12 16:54:37 +0000 |
commit | 661c41a09e39a182865e0b51e34cc995a0dc96e8 (patch) | |
tree | 2f79bb1406e22fdcb2587be8ffda6c0c609d7932 /Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm | |
parent | b645030efc22e13c2498a1522083634ab91b2de1 (diff) |
move tlperl.straw to tlperl
git-svn-id: svn://tug.org/texlive/trunk@18210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm')
-rwxr-xr-x | Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm b/Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm new file mode 100755 index 00000000000..f14a4c145aa --- /dev/null +++ b/Master/tlpkg/tlperl/lib/Test/Tester/CaptureRunner.pm @@ -0,0 +1,76 @@ +# $Header: /home/fergal/my/cvs/Test-Tester/lib/Test/Tester/CaptureRunner.pm,v 1.3 2003/03/05 01:07:55 fergal Exp $ +use strict; + +package Test::Tester::CaptureRunner; + +use Test::Tester::Capture; +require Exporter; + +sub new +{ + my $pkg = shift; + my $self = bless {}, $pkg; + return $self; +} + +sub run_tests +{ + my $self = shift; + + my $test = shift; + + capture()->reset; + + $self->{StartLevel} = $Test::Builder::Level; + &$test(); +} + +sub get_results +{ + my $self = shift; + my @results = capture()->details; + + my $start = $self->{StartLevel}; + foreach my $res (@results) + { + next if defined $res->{depth}; + my $depth = $res->{_depth} - $res->{_level} - $start - 3; +# print "my $depth = $res->{_depth} - $res->{_level} - $start - 1\n"; + $res->{depth} = $depth; + } + + return @results; +} + +sub get_premature +{ + return capture()->premature; +} + +sub capture +{ + return Test::Tester::Capture->new; +} + +__END__ + +=head1 NAME + +Test::Tester::CaptureRunner - Help testing test modules built with Test::Builder + +=head1 DESCRIPTION + +This stuff if needed to allow me to play with other ways of monitoring the +test results. + +=head1 AUTHOR + +Copyright 2003 by Fergal Daly <fergal@esatclear.ie>. + +=head1 LICENSE + +Under the same license as Perl itself + +See http://www.perl.com/perl/misc/Artistic.html + +=cut |