From: Mischa POSLAWSKY Date: Sat, 13 Mar 2021 03:54:50 +0000 (+0100) Subject: script to run examples from documentation X-Git-Tag: v1.08~27 X-Git-Url: http://git.shiar.net/barcat.git/commitdiff_plain/1de60201303fff6e0d612658790b4c44eff0c055 script to run examples from documentation --- diff --git a/t/examples.t b/t/examples.t new file mode 100755 index 0000000..19c1377 --- /dev/null +++ b/t/examples.t @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +use 5.014; +use warnings; +use Test::More; + +my $filename = 'barcat'; +open my $input, '<', $filename + or die "Cannot read documentation from $filename script\n"; + +local $/ = "\n\n"; +while (readline $input) { + /^=head1 EXAMPLES/ ... /^=head1/ or next; + /^\h/ or next; + chomp; + + my ($name) = /[\h(]*([^|]+)/; + ok(qx($_), $name); +} + +done_testing();