From 1de60201303fff6e0d612658790b4c44eff0c055 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 13 Mar 2021 04:54:50 +0100 Subject: [PATCH] script to run examples from documentation --- t/examples.t | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 t/examples.t 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(); -- 2.30.0