capture error messages from examples
[barcat.git] / t / examples.t
index 52e7a5a7b732f06bec7a4037617d8eb36afa1e7d..1af87e5fa5a368e799f589d5f6a2393f5d67dc73 100755 (executable)
@@ -52,8 +52,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 $.: $@");