Debian Codegraph @

t/boilerplate.t

raw symbols SCIP
1 #!perl -T
2
3 use strictscip-perl cpan WWW-Mechanize-GZip 0.14 strict/;
4 use warningsscip-perl cpan WWW-Mechanize-GZip 0.14 warnings/;
5 use Test::Morescip-perl cpan WWW-Mechanize-GZip 0.14 Test/More/ tests => 3;
6
7 sub not_in_file_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/not_in_file_ok(). {
8 my ($filename, %regex) = @_scip-perl cpan WWW-Mechanize-GZip 0.14 main/`@_`.;
9 openscip-perl cpan WWW-Mechanize-GZip 0.14 main/open(). my $fh, "<", $filename
10 or diescip-perl cpan WWW-Mechanize-GZip 0.14 main/die(). "couldn't open $filename for reading: $!";
11
12 my %violated;
13
14 while (my $line = <$fh>) {
15 while (my ($desc, $regex) = eachscip-perl cpan WWW-Mechanize-GZip 0.14 main/each(). %regex) {
16 if ($line =~ $regex) {
17 pushscip-perl cpan WWW-Mechanize-GZip 0.14 main/push(). @{$violated{$desc}||=[]}, $.scip-perl cpan WWW-Mechanize-GZip 0.14 main/`$.`.;
18 }
19 }
20 }
21
22 if (%violated) {
23 failscip-perl cpan WWW-Mechanize-GZip 0.14 main/fail().("$filename contains boilerplate text");
24 diagscip-perl cpan WWW-Mechanize-GZip 0.14 main/diag(). "$_ appears on lines @{$violated{$_}}" for keysscip-perl cpan WWW-Mechanize-GZip 0.14 main/keys(). %violated;
25 } else {
26 passscip-perl cpan WWW-Mechanize-GZip 0.14 main/pass().("$filename contains no boilerplate text");
27 }
28 }
29
30 not_in_file_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/not_in_file_ok().(README =>
31 "The README is used..." => qr/The README is used/,
32 "'version information here'" => qr/to provide version information/,
33 );
34
35 not_in_file_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/not_in_file_ok().(Changes =>
36 "placeholder date/time" => qr(Date/time)
37 );
38
39 sub module_boilerplate_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/module_boilerplate_ok(). {
40 my ($module) = @_scip-perl cpan WWW-Mechanize-GZip 0.14 main/`@_`.;
41 not_in_file_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/not_in_file_ok().($module =>
42 'the great new $MODULENAME' => qr/ - The great new /,
43 'boilerplate description' => qr/Quick summary of what the module/,
44 'stub function definition' => qr/function[12]/,
45 );
46 }
47
48 module_boilerplate_okscip-perl cpan WWW-Mechanize-GZip 0.14 main/module_boilerplate_ok().('lib/WWW/Mechanize/GZip.pm');