#!/usr/bin/perl use strict; use Test::More; my %check; my @files = `$ENV{LJHOME}/bin/cvsreport.pl --map`; foreach my $line (@files) { chomp $line; $line =~ s!//!/!g; my ($rel, $path) = split(/\t/, $line); next if $path =~ /\.(gif|jpe?g|png|ico)$/i; next unless $path =~ /^livejournal\b/; $check{$rel} = 1; } unless ($ENV{TEST_TODO}) { plan skip_all => "This test fails too much to be run for everyone."; exit; } plan tests => scalar keys %check; my @bad; foreach my $f (sort keys %check) { my $badct = 0; open (my $fh, $f) or die; my $linenum = 0; my $bad = sub { my $line = shift; chomp $line; $badct++; my $errmsg = "BAD LINE in $f:$linenum: $line"; diag($errmsg); push @bad, $errmsg; }; while (<$fh>) { $linenum++; $bad->($_) if /paid/i; $bad->($_) if /voice\s*post/i; $bad->($_) if /phone\s*post/i; $bad->($_) if /sponsored/i; } is($badct, 0, "no bad refs in $f"); } diag($_) foreach @bad;