t/examples: record resulting output for review
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 17 Nov 2022 18:16:03 +0000 (19:16 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Nov 2022 18:49:29 +0000 (19:49 +0100)
.gitignore [new file with mode: 0644]
Makefile
t/examples.t

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9239659
--- /dev/null
@@ -0,0 +1,5 @@
+# download external resources
+/sample/data
+
+# review test results
+/sample/out
index d6f0e7f2896cb1493c371a0a78d5408dbb78dba5..2775a1dfee321c4b3f7ec8235867cc94d2363127 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,10 @@ barcat: reformat-podusage
        ./$< $@
 
 test:
-       prove -f t/regress.t
+       t/regress.t
+tests:
+       mkdir -p sample/out
+       prove -f
 
 install: barcat
        $(INSTALL) -d '$(bindir)'
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 {