5 use Test::More tests => 3;
8 my ($filename, %regex) = @_;
9 open( my $fh, '<', $filename )
10 or die "couldn't open $filename for reading: $!";
14 while (my $line = <$fh>) {
15 while (my ($desc, $regex) = each %regex) {
16 if ($line =~ $regex) {
17 push @{$violated{$desc}||=[]}, $.;
23 fail("$filename contains boilerplate text");
24 diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
26 pass("$filename contains no boilerplate text");
30 sub module_boilerplate_ok {
32 not_in_file_ok($module =>
33 'the great new $MODULENAME' => qr/ - The great new /,
34 'boilerplate description' => qr/Quick summary of what the module/,
35 'stub function definition' => qr/function[12]/,
39 not_in_file_ok(README =>
40 "The README is used..." => qr/The README is used/,
41 "'version information here'" => qr/to provide version information/,
44 not_in_file_ok(Changes =>
45 "placeholder date/time" => qr(Date/time)
48 module_boilerplate_ok('lib/B/RecDeparse.pm');