capture error messages from examples
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 19 Mar 2021 02:40:22 +0000 (03:40 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Apr 2022 09:04:29 +0000 (11:04 +0200)
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 $.: $@");