KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > tidy > TidyCrashingBugsTest


1 /**
2  * Java HTML Tidy - JTidy
3  * HTML parser and pretty printer
4  *
5  * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
6  * Institute of Technology, Institut National de Recherche en
7  * Informatique et en Automatique, Keio University). All Rights
8  * Reserved.
9  *
10  * Contributing Author(s):
11  *
12  * Dave Raggett <dsr@w3.org>
13  * Andy Quick <ac.quick@sympatico.ca> (translation to Java)
14  * Gary L Peskin <garyp@firstech.com> (Java development)
15  * Sami Lempinen <sami@lempinen.net> (release management)
16  * Fabrizio Giustina <fgiust at users.sourceforge.net>
17  *
18  * The contributing author(s) would like to thank all those who
19  * helped with testing, bug fixes, and patience. This wouldn't
20  * have been possible without all of you.
21  *
22  * COPYRIGHT NOTICE:
23  *
24  * This software and documentation is provided "as is," and
25  * the copyright holders and contributing author(s) make no
26  * representations or warranties, express or implied, including
27  * but not limited to, warranties of merchantability or fitness
28  * for any particular purpose or that the use of the software or
29  * documentation will not infringe any third party patents,
30  * copyrights, trademarks or other rights.
31  *
32  * The copyright holders and contributing author(s) will not be
33  * liable for any direct, indirect, special or consequential damages
34  * arising out of any use of the software or documentation, even if
35  * advised of the possibility of such damage.
36  *
37  * Permission is hereby granted to use, copy, modify, and distribute
38  * this source code, or portions hereof, documentation and executables,
39  * for any purpose, without fee, subject to the following restrictions:
40  *
41  * 1. The origin of this source code must not be misrepresented.
42  * 2. Altered versions must be plainly marked as such and must
43  * not be misrepresented as being the original source.
44  * 3. This Copyright notice may not be removed or altered from any
45  * source or altered source distribution.
46  *
47  * The copyright holders and contributing author(s) specifically
48  * permit, without fee, and encourage the use of this source code
49  * as a component for supporting the Hypertext Markup Language in
50  * commercial products. If you use this source code in a product,
51  * acknowledgment is not required but would be appreciated.
52  *
53  */

54 package org.w3c.tidy;
55
56 import java.io.File JavaDoc;
57 import java.text.NumberFormat JavaDoc;
58
59
60 /**
61  * Testcase for Tidy resolved bugs. Bugs that crashed tidy or caused infinite loops.
62  * @author fgiust
63  * @version $Revision: 1.16 $ ($Author: fgiust $)
64  */

65 public class TidyCrashingBugsTest extends TidyTestCase
66 {
67
68     /**
69      * Instantiate a new Test case.
70      * @param name test name
71      */

72     public TidyCrashingBugsTest(String JavaDoc name)
73     {
74         super(name);
75     }
76
77     /**
78      * test for Tidy [427664] : Missing attr values cause NULL segfault.
79      * @throws Exception any exception generated during the test
80      */

81     public void test427664() throws Exception JavaDoc
82     {
83         executeTidyTest("427664.html");
84     }
85
86     /**
87      * test for Tidy [427671] : &lt;LI&gt; w/FRAME/FRAMESET/OPTGROUP/OPTION loop.
88      * @throws Exception any exception generated during the test
89      */

90     public void test427671() throws Exception JavaDoc
91     {
92         executeTidyTest("427671.html");
93     }
94
95     /**
96      * test for Tidy [427675] : Frameset followed by frame infinite loop.
97      * @throws Exception any exception generated during the test
98      */

99     public void test427675() throws Exception JavaDoc
100     {
101         executeTidyTest("427675.html");
102     }
103
104     /**
105      * test for Tidy [427676] : Missing = from attr value NULL segfault.
106      * @throws Exception any exception generated during the test
107      */

108     public void test427676() throws Exception JavaDoc
109     {
110         executeTidyTest("427676.html");
111     }
112
113     /**
114      * test for Tidy [427672] : Non-std attrs w/multibyte names segfault.
115      * @throws Exception any exception generated during the test
116      */

117     public void test427672() throws Exception JavaDoc
118     {
119         executeTidyTest("427672.html");
120     }
121
122     /**
123      * test for Tidy [426885] : Definition list w/Center crashes.
124      * @throws Exception any exception generated during the test
125      */

126     public void test426885() throws Exception JavaDoc
127     {
128         executeTidyTest("426885.html");
129     }
130
131     /**
132      * test for Tidy [427811] : FRAME inside NOFRAME infinite loop.
133      * @throws Exception any exception generated during the test
134      */

135     public void test427811() throws Exception JavaDoc
136     {
137         executeTidyTest("427811.html");
138     }
139
140     /**
141      * test for Tidy [427813] : Missing = from attr value segfaults.
142      * @throws Exception any exception generated during the test
143      */

144     public void test427813() throws Exception JavaDoc
145     {
146         executeTidyTest("427813.html");
147     }
148
149     /**
150      * test for Tidy [427816] : Mismatched quotes for attr segfaults.
151      * @throws Exception any exception generated during the test
152      */

153     public void test427816() throws Exception JavaDoc
154     {
155         executeTidyTest("427816.html");
156     }
157
158     /**
159      * test for Tidy [427818] : Missing quotes cause segfaults.
160      * @throws Exception any exception generated during the test
161      */

162     public void test427818() throws Exception JavaDoc
163     {
164         executeTidyTest("427818.html");
165     }
166
167     /**
168      * test for Tidy [427840] : Span causes infinite loop.
169      * @throws Exception any exception generated during the test
170      */

171     public void test427840() throws Exception JavaDoc
172     {
173         executeTidyTest("427840.html");
174     }
175
176     /**
177      * test for Tidy [427841] : Tidy crashes on badly formed HTML involving nested lists.
178      * @throws Exception any exception generated during the test
179      */

180     public void test427841() throws Exception JavaDoc
181     {
182         executeTidyTest("427841.html");
183     }
184
185     /**
186      * test for Tidy [431716] : -slides causes a seg fault.
187      * @throws Exception any exception generated during the test
188      */

189     public void test431716() throws Exception JavaDoc
190     {
191         executeTidyTest("431716.html");
192
193         // delete generates slides (this should be done in tear down be I'm pretty confident tidy will not crash here)
194
NumberFormat JavaDoc numberFormat = NumberFormat.getInstance();
195         numberFormat.setMinimumIntegerDigits(3);
196         for (int j = 1; j <= 26; j++)
197         {
198             String JavaDoc slide = "slide" + numberFormat.format(j) + ".html";
199             (new File JavaDoc(slide)).delete();
200         }
201     }
202
203     /**
204      * test for Tidy [443362] : null-pointer exception for doctype in pre.
205      * @throws Exception any exception generated during the test
206      */

207     public void test443362() throws Exception JavaDoc
208     {
209         executeTidyTest("443362.html");
210     }
211
212     /**
213      * test for Tidy [433856] : Access violation w/Word files w/font tag.
214      * @throws Exception any exception generated during the test
215      */

216     public void test433856() throws Exception JavaDoc
217     {
218         executeTidyTest("433856.html");
219     }
220
221     /**
222      * test for Tidy [532535] : Hang when in code &lt;?xml /&gt;.
223      * @throws Exception any exception generated during the test
224      */

225     public void test532535() throws Exception JavaDoc
226     {
227         executeTidyTest("532535.html");
228     }
229
230     /**
231      * test for Tidy [539369] : Infinite loop &lt;/frame&gt; after &lt;/frameset&gt;.
232      * @throws Exception any exception generated during the test
233      */

234     public void test539369() throws Exception JavaDoc
235     {
236         executeTidyTest("539369.html");
237     }
238
239     /**
240      * test for Tidy [539369a] : Test &lt;/frameset&gt; inside &lt;noframes&gt; (infinite loop).
241      * @throws Exception any exception generated during the test
242      */

243     public void test539369a() throws Exception JavaDoc
244     {
245         executeTidyTest("539369a.html");
246     }
247
248     /**
249      * test for Tidy [540296] : Tidy dumps.
250      * @throws Exception any exception generated during the test
251      */

252     public void test540296() throws Exception JavaDoc
253     {
254         executeTidyTest("540296.html");
255     }
256
257     /**
258      * test for Tidy [542029] : PPrintXmlDecl reads outside array range.
259      * @throws Exception any exception generated during the test
260      */

261     public void test542029() throws Exception JavaDoc
262     {
263         executeTidyTest("542029.html");
264     }
265
266     /**
267      * test for Tidy [572154] : frame element outside of a frameset causes infinite loop.
268      * @throws Exception any exception generated during the test
269      */

270     public void test572154() throws Exception JavaDoc
271     {
272         executeTidyTest("572154.html");
273     }
274
275     /**
276      * test for Tidy [543262] : tidy eats all memory.
277      * @throws Exception any exception generated during the test
278      */

279     public void test543262() throws Exception JavaDoc
280     {
281         executeTidyTest("543262.html");
282     }
283
284     /**
285      * test for Tidy [545772] : --output-xhtml hangs on most files.
286      * @throws Exception any exception generated during the test
287      */

288     public void test545772() throws Exception JavaDoc
289     {
290         executeTidyTest("545772.html");
291     }
292
293     /**
294      * test for Tidy [566542] : parser hangs.
295      * @throws Exception any exception generated during the test
296      */

297     public void test566542() throws Exception JavaDoc
298     {
299         executeTidyTest("566542.html");
300     }
301
302     /**
303      * test for Tidy [570027] : Fixes crash in Word2000 cleanup.
304      * @throws Exception any exception generated during the test
305      */

306     public void test570027() throws Exception JavaDoc
307     {
308         executeTidyTest("570027.html");
309     }
310
311     /**
312      * test for Tidy [588061] : Crash on www.tvnav.com.
313      * @throws Exception any exception generated during the test
314      */

315     public void test588061() throws Exception JavaDoc
316     {
317         executeTidyTest("588061.html");
318     }
319
320     /**
321      * test for Tidy [661606] : Two bytes at the last line, w/ asian options.
322      * @throws Exception any exception generated during the test
323      */

324     public void test661606() throws Exception JavaDoc
325     {
326         executeTidyTest("661606.html");
327     }
328
329     /**
330      * test for Tidy [671087] : tidy loops with --new-inline-tags table,tr,td.
331      * @throws Exception any exception generated during the test
332      */

333     public void test671087() throws Exception JavaDoc
334     {
335         executeTidyTest("671087.html");
336     }
337
338     /**
339      * test for Tidy [676205] : &lt;img SRC=&quot;&gt; crashes Tidy.
340      * @throws Exception any exception generated during the test
341      */

342     public void test676205() throws Exception JavaDoc
343     {
344         executeTidyTest("676205.html");
345     }
346
347     /**
348      * test for Tidy [679135] : Crashes while checking attributes.
349      * @throws Exception any exception generated during the test
350      */

351     public void test679135() throws Exception JavaDoc
352     {
353         executeTidyTest("679135.html");
354     }
355
356     /**
357      * test for Tidy [696799] : Crash: &lt;script language=&quot;&quot;&gt;.
358      * @throws Exception any exception generated during the test
359      */

360     public void test696799() throws Exception JavaDoc
361     {
362         executeTidyTest("696799.html");
363     }
364
365     /**
366      * test for Tidy [788031] : tidy hangs on input.
367      * @throws Exception any exception generated during the test
368      */

369     public void test788031() throws Exception JavaDoc
370     {
371         executeTidyTest("788031.html");
372     }
373
374     /**
375      * test for Tidy [837023] : segfault on doctype-like element.
376      * @throws Exception any exception generated during the test
377      */

378     public void test837023() throws Exception JavaDoc
379     {
380         executeTidyTest("837023.html");
381     }
382
383     /**
384      * test for Tidy [991469] : goes wrong with option tag.
385      * @throws Exception any exception generated during the test
386      */

387     public void test991469() throws Exception JavaDoc
388     {
389         executeTidyTest("991469.xml");
390     }
391
392     /**
393      * test for Tidy [991471] : NPE on file with CDATA.
394      * @throws Exception any exception generated during the test
395      */

396     public void test991471() throws Exception JavaDoc
397     {
398         executeTidyTest("991471.xml");
399     }
400
401     /**
402      * test for Tidy [1003994] : wrong UNEXPECTED_ENDTAG message.
403      * @throws Exception any exception generated during the test
404      */

405     public void test1003994() throws Exception JavaDoc
406     {
407         executeTidyTest("1003994.xml");
408         assertLogDoesntContains("{");
409     }
410
411     /**
412      * test for JTidy [1020806]: NPE when PPPrint'ing changed DOM tree.
413      * @throws Exception any exception generated during the test
414      */

415     public void test1020806() throws Exception JavaDoc
416     {
417         org.w3c.dom.Document JavaDoc doc = parseDomTest("1020806.html");
418         tidy.pprint(doc, System.out);
419     }
420
421     /**
422      * test for JTidy [1020806b]: NPE when PPPrint'ing changed DOM tree.
423      * @throws Exception any exception generated during the test
424      */

425     public void test1020806b() throws Exception JavaDoc
426     {
427         org.w3c.dom.Document JavaDoc doc = parseDomTest("1020806b.html");
428         tidy.pprint(doc, System.out);
429     }
430
431     /**
432      * test for JTidy [1033035]: EOF bug in parseAsp and parsePhp.
433      * @throws Exception any exception generated during the test
434      */

435     public void test1033035() throws Exception JavaDoc
436     {
437         executeTidyTest("1033035.html");
438     }
439
440 }
Popular Tags