]> git.imager.perl.org - imager.git/blob - t/x20spell.t
change version to avoid indexer confusion
[imager.git] / t / x20spell.t
1 #!perl -w
2 use strict;
3 use Test::More;
4 use ExtUtils::Manifest qw(maniread);
5 use File::Temp;
6 eval "use Pod::Spell 1.01";
7 plan skip_all => "Pod::Spell 1.01 required for spellchecking POD" if $@;
8 my $manifest = maniread();
9 my @pod = sort grep !/^inc/ && /\.(pm|pl|pod|PL)$/, keys %$manifest;
10 plan tests => scalar(@pod);
11 my @stopwords = qw/
12 API
13 Arnar
14 BMP
15 Blit
16 CGI
17 CMYK
18 CPAN
19 FreeType
20 GIF
21 HSV
22 Hrafnkelsson
23 ICO
24 IMAGER
25 Imager
26 Imager's
27 JPEG
28 PNG
29 PNM
30 RGB
31 RGBA
32 SGI
33 TGA
34 TIFF
35 UTF-8
36 Uncategorized
37 bilevel
38 const
39 dpi
40 eg
41 guassian
42 ie
43 infix
44 metadata
45 paletted
46 postfix
47 preload
48 preloading
49 preloads
50 renderer
51 tuple
52 unary
53 varargs
54 /;
55
56 local %Pod::Wordlist::Wordlist = %Pod::Wordlist::Wordlist;
57 for my $stop (@stopwords) {
58   $Pod::Wordlist::Wordlist{$stop} = 1;
59 }
60
61 # see for example:
62 #  https://bugs.launchpad.net/ubuntu/+source/aspell/+bug/71322
63 $ENV{LANG} = "C";
64 $ENV{LC_ALL} = "C";
65 for my $file (@pod) {
66   my $check_fh = File::Temp->new;
67   my $check_filename = $check_fh->filename;
68   open POD, "< $file"
69     or die "Cannot open $file for spell check: $!\n";
70   Pod::Spell->new->parse_from_filehandle(\*POD, $check_fh);
71   close $check_fh;
72   
73   my @out = `aspell list <$check_filename`;
74   unless (ok(@out == 0, "spell check $file")) {
75     chomp @out;
76     print "# $_\n" for @out;
77     print "#----\n";
78     open my $fh, "<", $check_filename;
79     while (<$fh>) {
80       chomp;
81       print "# $_\n";
82     }
83     print "#----\n";
84   }
85 }