File: 99-todo.t

package info (click to toggle)
libtest-without-module-perl 0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 100 kB
  • ctags: 10
  • sloc: perl: 139; makefile: 15
file content (44 lines) | stat: -rwxr-xr-x 909 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Test::More;
use File::Spec;
use File::Find;
use strict;

# Check that all files do not contain any
# lines with "XXX" - such markers should
# either have been converted into Todo-stuff
# or have been resolved.
# The test was provided by Andy Lester.

my @files;
my $blib = File::Spec->catfile(qw(blib lib));
find(\&wanted, $blib);
plan tests => scalar @files;
foreach my $file (@files) {
  source_file_ok($file);
}

sub wanted {
  push @files, $File::Find::name if /\.p(l|m|od)$/;
}

sub source_file_ok {
    my $file = shift;

    local *FILE;
    open FILE, $file
        or die "Can't open $file: $!";
    my @lines = <FILE>;
    close FILE;

    my $n = 0;
    for ( @lines ) {
        ++$n;
        s/^/$file ($n): /;
    }

    my @x = grep /XXX/, @lines;

    if ( !is( scalar @x, 0, "Looking for XXXes in $file" ) ) {
        diag( $_ ) for @x;
    }
}