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