#!/usr/bin/perl use strict; use warnings; use Test::Harness::Straps; use IPC::Run3; my $strap = Test::Harness::Straps->new(); show_failures( $_ ) for @ARGV; sub show_failures { my $file = shift; my $result = test_result( $file ); show_details( $result ) unless is_expected( $result ); } sub test_result { my $file = shift; return { file => $file, $strap->analyze( $file, collect_stderr_and_stdout( $file ) ) }; } sub is_expected { my $result = shift; return $result->{ passing } && $result->{ bonus } == 0; }; sub show_details { my $result = shift; print "$result->{file}\n", map { "* $_->{name}\n" . diagnostics( $_ ) } grep { ! is_expected_test_result( $_ ) } @{ $result->{ det +ails } }; } sub is_expected_test_result { my $test_result = shift; return $test_result->{ok} && ! is_unexpected_todo_success( $test_result ) && ! diagnostics( $_ ); } sub diagnostics { my $test_result = shift; return $test_result->{ diagnostics } if $test_result->{ diagnostic +s }; return " unexpected success from TODO test\n" if is_unexpected_todo_success( $test_result ); return ''; } sub is_unexpected_todo_success { my $test_result = shift; return $test_result->{type} eq "todo" && $test_result->{actual_ok} } sub collect_stderr_and_stdout { my $file = shift; my $command = [ $strap->_command, $strap->_switches( $file ) || () +, $file ]; my $output = []; run3( $command, \undef, $output, $output ) || die "run3: $!\n"; return $output; }

In reply to Quiet test runner by adrianh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.