]> git.imager.perl.org - imager.git/blob - t/x20spell.t
bump FT2 version to differentiate from Imager 0.93_02
[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 chromaticities
18 CMYK
19 CPAN
20 FreeType
21 GIF
22 HSV
23 Hrafnkelsson
24 ICO
25 IMAGER
26 Imager
27 Imager's
28 JPEG
29 POSIX
30 PNG
31 PNM
32 RGB
33 RGBA
34 SGI
35 sRGB
36 TGA
37 TIFF
38 UTF-8
39 Uncategorized
40 bilevel
41 const
42 dpi
43 eg
44 gaussian
45 ie
46 infix
47 invocant
48 metadata
49 multi-threaded
50 mutex
51 paletted
52 postfix
53 preload
54 preloading
55 preloads
56 renderer
57 tuple
58 unary
59 unseekable
60 varargs
61 /;
62
63 local %Pod::Wordlist::Wordlist = %Pod::Wordlist::Wordlist;
64 for my $stop (@stopwords) {
65   $Pod::Wordlist::Wordlist{$stop} = 1;
66 }
67
68 # see for example:
69 #  https://bugs.launchpad.net/ubuntu/+source/aspell/+bug/71322
70 $ENV{LANG} = "C";
71 $ENV{LC_ALL} = "C";
72 for my $file (@pod) {
73   my $check_fh = File::Temp->new;
74   my $check_filename = $check_fh->filename;
75   open POD, "< $file"
76     or die "Cannot open $file for spell check: $!\n";
77   Pod::Spell->new->parse_from_filehandle(\*POD, $check_fh);
78   close $check_fh;
79   
80   my @out = `aspell list <$check_filename`;
81   unless (ok(@out == 0, "spell check $file")) {
82     chomp @out;
83     diag $_ for @out;
84     print "#----\n";
85     open my $fh, "<", $check_filename;
86     while (<$fh>) {
87       chomp;
88       print "# $_\n";
89     }
90     print "#----\n";
91   }
92 }