diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm b/Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm index 678ea2f0e3d..af7b3fca304 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Formatter/Base.pm @@ -25,13 +25,27 @@ BEGIN { show_count => sub { shift; shift }, stdout => sub { my ( $self, $ref ) = @_; + $self->_croak("option 'stdout' needs a filehandle") - unless ( ref $ref || '' ) eq 'GLOB' - or eval { $ref->can('print') }; + unless $self->_is_filehandle($ref); + return $ref; }, ); + sub _is_filehandle { + my ( $self, $ref ) = @_; + + return 0 if !defined $ref; + + return 1 if ref $ref eq 'GLOB'; # lexical filehandle + return 1 if !ref $ref && ref \$ref eq 'GLOB'; # bare glob like *STDOUT + + return 1 if eval { $ref->can('print') }; + + return 0; + } + my @getter_setters = qw( _longest _printed_summary_header @@ -47,11 +61,11 @@ TAP::Formatter::Base - Base class for harness output delegates =head1 VERSION -Version 3.23 +Version 3.26 =cut -$VERSION = '3.23'; +$VERSION = '3.26'; =head1 DESCRIPTION @@ -375,9 +389,11 @@ sub _summary_test_header { my $spaces = ' ' x ( $self->_longest - length $test ); $spaces = ' ' unless $spaces; my $output = $self->_get_output_method($parser); + my $wait = $parser->wait; + defined $wait or $wait = '(none)'; $self->$output( - sprintf "$test$spaces(Wstat: %d Tests: %d Failed: %d)\n", - $parser->wait, $parser->tests_run, scalar $parser->failed + sprintf "$test$spaces(Wstat: %s Tests: %d Failed: %d)\n", + $wait, $parser->tests_run, scalar $parser->failed ); $self->_printed_summary_header(1); } |