t/examples: record resulting output for review
[barcat.git] / t / examples.t
index cdf77f9ca0ace15ecaea2de243129e3ba83822db..a331ce352d5322d9aa26b8f4e0af1973ea7c1555 100755 (executable)
@@ -72,6 +72,13 @@ while (readline $input) {
        my $output = runres($cmd);
        ok(!!$output, $name)
                or diag("command at $ref\n$cmd\n" . ($@ || 'empty output'));
+       defined $output or next;
+
+       # record output for review
+       my $numprefix = sprintf '%02d', Test::More->builder->current_test;
+       if (open my $record, '>', "sample/out/t$numprefix-$name.txt") {
+               print {$record} $output;
+       }
 }
 
 sub runres {