t/55-eg: check example pages for warnings
[perl/plp/.git] / t / 55-eg.t
1 use strict;
2 use warnings;
3
4 use File::Basename qw( dirname );
5 use File::Spec;
6 use Test::More tests => 4;
7
8 use_ok('Test::PLP');
9
10 sub lacks_string($$;$) {
11         unlike($_[0], qr/\Q$_[1]/, $_[2]);
12 }
13 eval {
14         Test::LongString->import('lacks_string');  # set up by Test::PLP
15 };
16
17 chdir File::Spec->catdir(dirname($0), '..', 'eg')
18         or BAIL_OUT('cannot change to test directory ../eg/');
19
20 for my $file (glob '*.plp') {
21         (my $name = $file) =~ s/[.][^.]+$//;
22         my $output = plp_is($file, undef, undef, undef, $name);
23         lacks_string($output, '"PLPerror"', "$name no errors");
24         lacks_string($output, '<warning>', "$name no warnings");
25 }
26