added subclassing tutorials
[gitmo/moose-website.git] / t / 02-spelling.t
1 #!perl
2 use 5.010;
3 use utf8;
4 use strict;
5 use warnings FATAL => 'all';
6 use autodie qw(:all);
7 use Capture::Tiny qw(capture);
8 use Encode qw(encode_utf8 decode_utf8);
9 use File::Next qw();
10 use File::Temp qw(tempfile);
11 use File::Which qw(which);
12 use Module::Build qw();
13 use Test::More;
14 use XML::LibXML qw();
15 use XML::LibXSLT qw();
16 use YAML::XS qw(Load);
17
18 binmode Test::More->builder->$_, ':encoding(UTF-8)'
19     for qw(output failure_output todo_output);
20
21 # Skip means sweep bugs under the rug.
22 # I want this test to be actually run.
23 BAIL_OUT 'aspell is not installed.' unless which 'aspell';
24
25 my $build;
26 eval { $build = Module::Build->current; 1; }
27   or BAIL_OUT 'We are not in a Module::Build session. Run Build.PL first.';
28
29 my $locale = $build->notes('locale');
30 my @stopwords;
31 {
32     local $/ = undef;
33     my $yaml = Load(encode_utf8(<DATA>));
34     @stopwords = map {
35         # kill scalar's IV NV or else the smart-match later will bomb out
36         $_ eq 'Infinity' ? 'Infinity' : $_
37     } @{ $yaml->{$locale} };
38 }
39
40 my $iter = File::Next::files({
41         file_filter => sub {/\.html \z/msx},
42         sort_files  => 1,
43     },
44     $build->destdir
45 );
46
47 my $file_counter;
48
49 my $stylesheet = XML::LibXSLT->new->parse_stylesheet(
50     XML::LibXML->load_xml(string => <<""));
51 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
52     xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">
53     <xsl:template match="xhtml:*[\@xml:lang!='$locale']"/>
54     <xsl:template match="xhtml:abbr"/>
55     <xsl:template match="xhtml:acronym"/>
56     <xsl:template match="xhtml:code"/> <!-- filter computerese -->
57     <xsl:template match="\@* | node()"> <!-- apply identity function to rest of nodes -->
58         <xsl:copy>
59             <xsl:apply-templates select="\@* | node()"/>
60         </xsl:copy>
61     </xsl:template>
62 </xsl:stylesheet>
63
64 while (defined(my $html_file = $iter->())) {
65     $file_counter++;
66
67     my ($temp_handle, $temp_file) = tempfile;
68     my $transformed = $stylesheet->transform(XML::LibXML->load_xml(location => $html_file, load_ext_dtd => 0,));
69     $stylesheet->output_fh($transformed, $temp_handle);
70
71     my ($stdout) = capture {
72         system "aspell -H --encoding=UTF-8 -l $locale list < $temp_file";
73     };
74     my @misspelt_words = grep {!($_ ~~ @stopwords)} split /\n/, decode_utf8 $stdout;
75     ok !@misspelt_words, "$html_file ($temp_file) spell-check";
76     diag join "\n", sort @misspelt_words if @misspelt_words;
77 }
78
79 done_testing($file_counter);
80
81 __DATA__
82 ---
83 en:
84 ## personal names
85 - Brocard
86 - Bunce's
87 # Pierce Cawley
88 - Cawley's
89 - Champoux
90 - chromatic
91 # Sam Crawley
92 - Crawley
93 - cuny's
94 - Doran
95 - franck
96 - Grünauer
97 - hakobe's
98 - hanekomu
99 - JT
100 - Hengst's
101 # Kanat-Alexander
102 - Kanat
103 - Kogman
104 - Kogman's
105 - Kuri's
106 - Lenz
107 - Léon
108 - Luehrs's
109 - Napiorkowski
110 - Pearcey's
111 - Perek's
112 - Prather
113 - Prather's
114 - Ragwitz
115 - Rockway
116 - Rodighiero
117 - Rolsky's
118 - SawyerX's
119 - Shlomi
120 - Stevan
121 - sunnavy's
122 - Treder's
123 - trombik
124 - Vecchi
125 - Vilain
126 - Vilain's
127 - Yanick
128 - Ynon
129 - Yuval
130
131 ## proper names
132 - AirG
133 - BizRate
134 - CATH
135 - CLAB
136 - Cisco
137 - Cloudtone
138 - DoctorBase
139 - Endeworks
140 - FOSDEM
141 - GitHub
142 - Gource
143 - IMDb
144 # Kansai.pm
145 - Kansai
146 - Linkfluence
147 - LinuxMag
148 - Matsch
149 - MedTouch
150 - MusicBrainz
151 - OCaml
152 - Omni
153 - OnLAMP
154 - PerlMonks
155 - Pobox
156 - Shadowcat
157 - Shopzilla
158 - SimplyClick
159 - Simula
160 - SocialText
161 - Symantec
162 - Takkle
163 - Tamarou
164 - TextMate
165 - UNMC
166 - UNO
167 - ValueClick
168 - WebGUI
169
170 ## Moose-specific
171
172 ## computerese
173 - Parameterized
174 - parameterized
175
176 ## other jargon
177
178 ## neologisms
179 - Blog
180 - blog
181 - podcast
182
183 ## compound
184 # post-mortem
185 - mortem
186 # PDX.pm
187 - PDX
188 # London.pm's
189 - pm's
190
191 ## slang
192
193 ## things that should be in the dictionary, but are not
194 - Bioinformatics
195 - Committers
196 - refactoring
197 - Refactoring
198
199 ## single foreign words
200
201 ## misspelt on purpose
202
203 de:
204
205 ## Personennamen
206 - Apocalypse
207 - Austin
208 - Austins
209 - Barry
210 - Boones
211 - Brocard
212 - Bruno
213 - Bunce
214 - Cawleys
215 - Champoux
216 - Chris
217 - chromatic
218 - Cory
219 - Crawley
220 - cunys
221 - Dave
222 - Devin
223 - Doran
224 - Doug
225 - Drew
226 - Fish
227 - franck
228 - Grünauer
229 - hakobes
230 - hanekomu
231 - Hengsts
232 - Jay
233 - Jesse
234 - Jonathan
235 - JT
236 - Kanat
237 - Kogman
238 - Kogmans
239 - Kuri
240 - Larry
241 - Léon
242 - Luehrs
243 - Little
244 - Littles
245 - Marcel
246 - Moritz
247 - McLaughlin
248 - Mike
249 - Napiorkowski
250 - Ovid
251 - Ovids
252 - Pearceys
253 - Pereks
254 - Piers
255 - Prather
256 - Prathers
257 - Ragwitz
258 - Randal
259 - Rockway
260 - Rodighiero
261 - Rolsky
262 - Rolskys
263 - SawyerX
264 - Schwartz
265 - Shawn
266 - Shlomi
267 - Smith
268 - Stefano
269 - Stephens
270 - Stevan
271 - Stuart
272 - sunnavys
273 - Tomas
274 - Treders
275 - trombik
276 - Trout
277 - Vecchi
278 - Vilain
279 - Vilains
280 - Walsh
281 - Watsons
282 - Whitakers
283 - Yanick
284 - Ynon
285 - Yuval
286
287 ## Eigennamen
288 - Beijing
289 - Catalyst
290 - Doodle
291 - Expanse
292 - FOSDEM
293 - Frozen
294 - Git
295 - GitHub
296 - Gource
297 - Houston
298 - Infinity
299 - Interactive
300 - Kansai
301 - Lacuna
302 - LinuxMag
303 - Melbourne
304 - Nashville
305 - Oasis
306 - OCaml
307 - OnLAMP
308 - Overflow
309 - PerlMonks
310 - Pittsburgh
311 - Ruby
312 - Simula
313 - TextMate
314 - WebGUI
315
316 ## Moose-spezifisch
317 - Metaobjektprotokoll
318 - MOP
319 - Mouse
320 - parameterisierte
321 - Objektmetaprogrammierung
322
323 ## Computerjargon
324 - Beispielcode
325 - Codewiederverwendung
326
327 ## anderer Jargon
328 - Perlmonger
329 - Podcast
330
331 ## Neologismen
332
333 ## Verbundworte
334 # Duck-Typing
335 - Duck
336 - Typing
337 # Lese-Evaluierungs-Ausgabe-Schleife
338 - Evaluierungs
339 # 100%ig
340 - ig
341 # Perl.it
342 - it
343 # E-Lamp
344 - Lamp
345 # Meta-Moose
346 - Meta
347 # PDX.pm
348 - PDX
349 # Plug-In
350 - Plug
351 # diverse .pm
352 - pm
353 # RC-Dateien
354 - RC
355
356 ## Umgangssprache
357
358 ## nicht im Wörterbuch, aber sollte drin stehen
359 - Antiquierung
360 - Blog
361 - Blogeintrag
362 - Blogeinträge
363 - Datenkapselung
364 - Endbericht
365 - Expertenschulung
366 - Gemeinschaftsprojekt
367 - Gruppentreffen
368 - Hauptdistribution
369 - Hauptseite
370 - Hilfeangeboten
371 - nachzuschlagen
372 - Objektsystem
373 - Objektsystems
374 - Produktionseinsatz
375 - Proteinanalyse
376 - rollenbasierten
377 - Rollenzusammensetzung
378 - Schnellreferenzkarte
379 - Skriptoptionen
380 - Vortragsfolien
381 - Webansicht
382
383 ## einzelne Fremdwörter
384 - Refactoring
385 - Repository
386 - Repositorys
387
388 ## absichtlich falsch