Debian Codegraph @

xt/99-todo.t

raw
1 use Test::More;
2 use File::Spec;
3 use File::Find;
4 use strict;
5
6 # Check that all files do not contain any
7 # lines with "XXX" - such markers should
8 # either have been converted into Todo-stuff
9 # or have been resolved.
10 # The test was provided by Andy Lester.
11
12 require './Makefile.PL';
13 # Loaded from Makefile.PL
14 our %module = get_module_info();
15
16 my @files;
17 my $blib = File::Spec->catfile(qw(blib lib));
18 find(\&wanted, grep { -d } ($blib));
19
20 if( my $exe = $module{EXE_FILES}) {
21 push @files, @$exe;
22 };
23
24 plan tests => 2* @files;
25 foreach my $file (@files) {
26 source_file_ok($file);
27 }
28
29 sub wanted {
30 push @files, $File::Find::name if /\.p(l|m|od)$/;
31 }
32
33 sub source_file_ok {
34 my $file = shift;
35
36 open( my $fh, '<', $file ) or die "Can't open $file: $!";
37 my @lines = <$fh>;
38 close $fh;
39
40 my $n = 0;
41 for ( @lines ) {
42 ++$n;
43 s/^/$file ($n): /;
44 }
45
46 my @x = grep /XXX/, @lines;
47
48 if ( !is( scalar @x, 0, "Looking for XXXes in $file" ) ) {
49 diag( $_ ) for @x;
50 }
51 @x = grep /<<<|>>>/, @lines;
52
53 if ( !is( scalar @x, 0, "Looking for <<<<|>>>> in $file" ) ) {
54 diag( $_ ) for @x;
55 }
56 }