script to run examples from documentation
[barcat.git] / t / examples.t
1 #!/usr/bin/env perl
2 use 5.014;
3 use warnings;
4 use Test::More;
5
6 my $filename = 'barcat';
7 open my $input, '<', $filename
8         or die "Cannot read documentation from $filename script\n";
9
10 local $/ = "\n\n";
11 while (readline $input) {
12         /^=head1 EXAMPLES/ ... /^=head1/ or next;
13         /^\h/ or next;
14         chomp;
15
16         my ($name) = /[\h(]*([^|]+)/;
17         ok(qx($_), $name);
18 }
19
20 done_testing();