1 package TAP::Formatter::File::Session;
4 use TAP::Formatter::Session;
6 use vars qw($VERSION @ISA);
8 @ISA = qw(TAP::Formatter::Session);
12 TAP::Formatter::File::Session - Harness output delegate for file output
24 This provides file orientated output formatting for L<TAP::Harness>.
25 It is particularly important when running with parallel tests, as it
26 ensures that test results are not interleaved, even when run
35 Stores results for later output, all together.
43 my $parser = $self->parser;
44 my $formatter = $self->formatter;
46 if ( $result->is_bailout ) {
47 $formatter->_failure_output(
48 "Bailout called. Further testing stopped: "
49 . $result->explanation
54 if (!$formatter->quiet
55 && ( $formatter->verbose
56 || ( $result->is_test && $formatter->failures && !$result->is_ok )
57 || ( $formatter->comments && $result->is_comment )
58 || ( $result->has_directive && $formatter->directives ) )
61 $self->{results} .= $self->_format_for_output($result) . "\n";
67 When the test file finishes, outputs the summary, together.
74 # Avoid circular references
77 my $parser = $self->parser;
78 my $formatter = $self->formatter;
79 my $pretty = $formatter->_format_name( $self->name );
81 return if $formatter->really_quiet;
82 if ( my $skip_all = $parser->skip_all ) {
83 $formatter->_output( $pretty . "skipped: $skip_all\n" );
85 elsif ( $parser->has_problems ) {
87 $pretty . ( $self->{results} ? "\n" . $self->{results} : "\n" ) );
88 $self->_output_test_failure($parser);
92 if ( $formatter->timer ) {
93 my $start_time = $parser->start_time;
94 my $end_time = $parser->end_time;
95 if ( defined $start_time and defined $end_time ) {
96 my $elapsed = $end_time - $start_time;
98 = $self->time_is_hires
99 ? sprintf( ' %8d ms', $elapsed * 1000 )
100 : sprintf( ' %8s s', $elapsed || '<1' );
104 $formatter->_output( $pretty
105 . ( $self->{results} ? "\n" . $self->{results} : "" )
106 . "ok$time_report\n" );