]> git.imager.perl.org - imager.git/blob - t/x20spell.t
[rt #72369] Document the return value of the filter() method
[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 POSIX
29 PNG
30 PNM
31 RGB
32 RGBA
33 SGI
34 TGA
35 TIFF
36 UTF-8
37 Uncategorized
38 bilevel
39 const
40 dpi
41 eg
42 gaussian
43 ie
44 infix
45 invocant
46 metadata
47 paletted
48 postfix
49 preload
50 preloading
51 preloads
52 renderer
53 tuple
54 unary
55 varargs
56 /;
57
58 local %Pod::Wordlist::Wordlist = %Pod::Wordlist::Wordlist;
59 for my $stop (@stopwords) {
60   $Pod::Wordlist::Wordlist{$stop} = 1;
61 }
62
63 # see for example:
64 #  https://bugs.launchpad.net/ubuntu/+source/aspell/+bug/71322
65 $ENV{LANG} = "C";
66 $ENV{LC_ALL} = "C";
67 for my $file (@pod) {
68   my $check_fh = File::Temp->new;
69   my $check_filename = $check_fh->filename;
70   open POD, "< $file"
71     or die "Cannot open $file for spell check: $!\n";
72   Pod::Spell->new->parse_from_filehandle(\*POD, $check_fh);
73   close $check_fh;
74   
75   my @out = `aspell list <$check_filename`;
76   unless (ok(@out == 0, "spell check $file")) {
77     chomp @out;
78     diag $_ for @out;
79     print "#----\n";
80     open my $fh, "<", $check_filename;
81     while (<$fh>) {
82       chomp;
83       print "# $_\n";
84     }
85     print "#----\n";
86   }
87 }