File: 99-todo.t

package info (click to toggle)
libhtml-display-perl 0.40-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 244 kB
  • sloc: perl: 1,166; makefile: 2
file content (42 lines) | stat: -rwxr-xr-x 893 bytes parent folder | download | duplicates (6)
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
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;

    open( my $fh, "<", $file ) or die "Can't open $file: $!";
    my @lines = <$fh>;
    close $fh;

    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;
    }
}