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