X-Git-Url: http://git.shiar.nl/barcat.git/blobdiff_plain/0bfa64faefa577d082b8e62aa0b53b11f307aec5..509cc3176a1ab80da8cd02badcd6fc6064d41e25:/t/examples.t diff --git a/t/examples.t b/t/examples.t index 52e7a5a..c5648ad 100755 --- a/t/examples.t +++ b/t/examples.t @@ -13,7 +13,7 @@ use Test::More; my %CMDARGS = ( ping => '-c 1', curl => '-sS', - 'cat \Klog/' => '/var/log/apache2/', + 'cat \Khttpd/' => '/var/log/apache2/', ); my $filename = 'barcat'; @@ -22,9 +22,10 @@ open my $input, '<', $filename local $/ = "\n\n"; while (readline $input) { - # find code snippets in the appropriate section + # find scriptlets in the appropriate section /^=head1 EXAMPLES/ ... /^=head1/ or next; - /^\h/ or next; + /^\h/ or next; # indented code snippet + /\A\h*>/ and next; # psql prompt chomp; # compose an identifier from significant parts @@ -52,8 +53,9 @@ while (readline $input) { # run and report unexpected results ok(eval { - run(\@cmd, \undef, \my $output); - $? == 0 or die "error status ", $? >> 8, "\n"; + run(\@cmd, \undef, \my $output, \my $error); + die("error message:\n $error\n") if $error; + $? == 0 or die "exit status ", $? >> 8, "\n"; length $output or die "empty output\n"; return 1; }, $name) or diag("Failed command\n@cmd\nfrom $filename line $.: $@");