diff options
author | Chad Granum <chad.granum@dreamhost.com> | 2014-08-15 08:40:10 -0700 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2014-08-16 23:19:29 +0200 |
commit | 6bdb88770f849c47b5c09e733ac460ce3e9dbc97 (patch) | |
tree | 3eda7f11aea1019f7a802c1caecfb81ab26e7761 /cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm | |
parent | 7d16fb5f4895e672484c0b7490722d46df82b099 (diff) | |
download | perl-6bdb88770f849c47b5c09e733ac460ce3e9dbc97.tar.gz |
Update to include latest Test::Builder alpha
Also updated some tests that the new builder broke
Diffstat (limited to 'cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm')
-rw-r--r-- | cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm new file mode 100644 index 0000000000..62bb7f2441 --- /dev/null +++ b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm @@ -0,0 +1,75 @@ +# $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; + +#warn "Test::Tester::CaptureRunner is deprecated, see Test::Tester2\n"; + +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; + $res->{depth} = $depth; + } + + return @results; +} + +sub get_premature { + return capture()->premature; +} + +sub capture { + return Test::Tester::Capture->new; +} + +__END__ + +=head1 NAME + +Test::Tester::CaptureRunner - *DEPRECATED* Help testing test modules built with Test::Builder + +=head1 DEPRECATED + +See L<Test::Tester2> for a modern and maintained alternative. + +=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 |