001: /**
002: * Java HTML Tidy - JTidy
003: * HTML parser and pretty printer
004: *
005: * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
006: * Institute of Technology, Institut National de Recherche en
007: * Informatique et en Automatique, Keio University). All Rights
008: * Reserved.
009: *
010: * Contributing Author(s):
011: *
012: * Dave Raggett <dsr@w3.org>
013: * Andy Quick <ac.quick@sympatico.ca> (translation to Java)
014: * Gary L Peskin <garyp@firstech.com> (Java development)
015: * Sami Lempinen <sami@lempinen.net> (release management)
016: * Fabrizio Giustina <fgiust at users.sourceforge.net>
017: *
018: * The contributing author(s) would like to thank all those who
019: * helped with testing, bug fixes, and patience. This wouldn't
020: * have been possible without all of you.
021: *
022: * COPYRIGHT NOTICE:
023: *
024: * This software and documentation is provided "as is," and
025: * the copyright holders and contributing author(s) make no
026: * representations or warranties, express or implied, including
027: * but not limited to, warranties of merchantability or fitness
028: * for any particular purpose or that the use of the software or
029: * documentation will not infringe any third party patents,
030: * copyrights, trademarks or other rights.
031: *
032: * The copyright holders and contributing author(s) will not be
033: * liable for any direct, indirect, special or consequential damages
034: * arising out of any use of the software or documentation, even if
035: * advised of the possibility of such damage.
036: *
037: * Permission is hereby granted to use, copy, modify, and distribute
038: * this source code, or portions hereof, documentation and executables,
039: * for any purpose, without fee, subject to the following restrictions:
040: *
041: * 1. The origin of this source code must not be misrepresented.
042: * 2. Altered versions must be plainly marked as such and must
043: * not be misrepresented as being the original source.
044: * 3. This Copyright notice may not be removed or altered from any
045: * source or altered source distribution.
046: *
047: * The copyright holders and contributing author(s) specifically
048: * permit, without fee, and encourage the use of this source code
049: * as a component for supporting the Hypertext Markup Language in
050: * commercial products. If you use this source code in a product,
051: * acknowledgment is not required but would be appreciated.
052: *
053: */package org.w3c.tidy;
054:
055: import java.io.File;
056: import java.text.NumberFormat;
057:
058: /**
059: * Testcase for Tidy resolved bugs. Bugs that crashed tidy or caused infinite loops.
060: * @author fgiust
061: * @version $Revision: 1.16 $ ($Author: fgiust $)
062: */
063: public class TidyCrashingBugsTest extends TidyTestCase {
064:
065: /**
066: * Instantiate a new Test case.
067: * @param name test name
068: */
069: public TidyCrashingBugsTest(String name) {
070: super (name);
071: }
072:
073: /**
074: * test for Tidy [427664] : Missing attr values cause NULL segfault.
075: * @throws Exception any exception generated during the test
076: */
077: public void test427664() throws Exception {
078: executeTidyTest("427664.html");
079: }
080:
081: /**
082: * test for Tidy [427671] : <LI> w/FRAME/FRAMESET/OPTGROUP/OPTION loop.
083: * @throws Exception any exception generated during the test
084: */
085: public void test427671() throws Exception {
086: executeTidyTest("427671.html");
087: }
088:
089: /**
090: * test for Tidy [427675] : Frameset followed by frame infinite loop.
091: * @throws Exception any exception generated during the test
092: */
093: public void test427675() throws Exception {
094: executeTidyTest("427675.html");
095: }
096:
097: /**
098: * test for Tidy [427676] : Missing = from attr value NULL segfault.
099: * @throws Exception any exception generated during the test
100: */
101: public void test427676() throws Exception {
102: executeTidyTest("427676.html");
103: }
104:
105: /**
106: * test for Tidy [427672] : Non-std attrs w/multibyte names segfault.
107: * @throws Exception any exception generated during the test
108: */
109: public void test427672() throws Exception {
110: executeTidyTest("427672.html");
111: }
112:
113: /**
114: * test for Tidy [426885] : Definition list w/Center crashes.
115: * @throws Exception any exception generated during the test
116: */
117: public void test426885() throws Exception {
118: executeTidyTest("426885.html");
119: }
120:
121: /**
122: * test for Tidy [427811] : FRAME inside NOFRAME infinite loop.
123: * @throws Exception any exception generated during the test
124: */
125: public void test427811() throws Exception {
126: executeTidyTest("427811.html");
127: }
128:
129: /**
130: * test for Tidy [427813] : Missing = from attr value segfaults.
131: * @throws Exception any exception generated during the test
132: */
133: public void test427813() throws Exception {
134: executeTidyTest("427813.html");
135: }
136:
137: /**
138: * test for Tidy [427816] : Mismatched quotes for attr segfaults.
139: * @throws Exception any exception generated during the test
140: */
141: public void test427816() throws Exception {
142: executeTidyTest("427816.html");
143: }
144:
145: /**
146: * test for Tidy [427818] : Missing quotes cause segfaults.
147: * @throws Exception any exception generated during the test
148: */
149: public void test427818() throws Exception {
150: executeTidyTest("427818.html");
151: }
152:
153: /**
154: * test for Tidy [427840] : Span causes infinite loop.
155: * @throws Exception any exception generated during the test
156: */
157: public void test427840() throws Exception {
158: executeTidyTest("427840.html");
159: }
160:
161: /**
162: * test for Tidy [427841] : Tidy crashes on badly formed HTML involving nested lists.
163: * @throws Exception any exception generated during the test
164: */
165: public void test427841() throws Exception {
166: executeTidyTest("427841.html");
167: }
168:
169: /**
170: * test for Tidy [431716] : -slides causes a seg fault.
171: * @throws Exception any exception generated during the test
172: */
173: public void test431716() throws Exception {
174: executeTidyTest("431716.html");
175:
176: // delete generates slides (this should be done in tear down be I'm pretty confident tidy will not crash here)
177: NumberFormat numberFormat = NumberFormat.getInstance();
178: numberFormat.setMinimumIntegerDigits(3);
179: for (int j = 1; j <= 26; j++) {
180: String slide = "slide" + numberFormat.format(j) + ".html";
181: (new File(slide)).delete();
182: }
183: }
184:
185: /**
186: * test for Tidy [443362] : null-pointer exception for doctype in pre.
187: * @throws Exception any exception generated during the test
188: */
189: public void test443362() throws Exception {
190: executeTidyTest("443362.html");
191: }
192:
193: /**
194: * test for Tidy [433856] : Access violation w/Word files w/font tag.
195: * @throws Exception any exception generated during the test
196: */
197: public void test433856() throws Exception {
198: executeTidyTest("433856.html");
199: }
200:
201: /**
202: * test for Tidy [532535] : Hang when in code <?xml />.
203: * @throws Exception any exception generated during the test
204: */
205: public void test532535() throws Exception {
206: executeTidyTest("532535.html");
207: }
208:
209: /**
210: * test for Tidy [539369] : Infinite loop </frame> after </frameset>.
211: * @throws Exception any exception generated during the test
212: */
213: public void test539369() throws Exception {
214: executeTidyTest("539369.html");
215: }
216:
217: /**
218: * test for Tidy [539369a] : Test </frameset> inside <noframes> (infinite loop).
219: * @throws Exception any exception generated during the test
220: */
221: public void test539369a() throws Exception {
222: executeTidyTest("539369a.html");
223: }
224:
225: /**
226: * test for Tidy [540296] : Tidy dumps.
227: * @throws Exception any exception generated during the test
228: */
229: public void test540296() throws Exception {
230: executeTidyTest("540296.html");
231: }
232:
233: /**
234: * test for Tidy [542029] : PPrintXmlDecl reads outside array range.
235: * @throws Exception any exception generated during the test
236: */
237: public void test542029() throws Exception {
238: executeTidyTest("542029.html");
239: }
240:
241: /**
242: * test for Tidy [572154] : frame element outside of a frameset causes infinite loop.
243: * @throws Exception any exception generated during the test
244: */
245: public void test572154() throws Exception {
246: executeTidyTest("572154.html");
247: }
248:
249: /**
250: * test for Tidy [543262] : tidy eats all memory.
251: * @throws Exception any exception generated during the test
252: */
253: public void test543262() throws Exception {
254: executeTidyTest("543262.html");
255: }
256:
257: /**
258: * test for Tidy [545772] : --output-xhtml hangs on most files.
259: * @throws Exception any exception generated during the test
260: */
261: public void test545772() throws Exception {
262: executeTidyTest("545772.html");
263: }
264:
265: /**
266: * test for Tidy [566542] : parser hangs.
267: * @throws Exception any exception generated during the test
268: */
269: public void test566542() throws Exception {
270: executeTidyTest("566542.html");
271: }
272:
273: /**
274: * test for Tidy [570027] : Fixes crash in Word2000 cleanup.
275: * @throws Exception any exception generated during the test
276: */
277: public void test570027() throws Exception {
278: executeTidyTest("570027.html");
279: }
280:
281: /**
282: * test for Tidy [588061] : Crash on www.tvnav.com.
283: * @throws Exception any exception generated during the test
284: */
285: public void test588061() throws Exception {
286: executeTidyTest("588061.html");
287: }
288:
289: /**
290: * test for Tidy [661606] : Two bytes at the last line, w/ asian options.
291: * @throws Exception any exception generated during the test
292: */
293: public void test661606() throws Exception {
294: executeTidyTest("661606.html");
295: }
296:
297: /**
298: * test for Tidy [671087] : tidy loops with --new-inline-tags table,tr,td.
299: * @throws Exception any exception generated during the test
300: */
301: public void test671087() throws Exception {
302: executeTidyTest("671087.html");
303: }
304:
305: /**
306: * test for Tidy [676205] : <img src="> crashes Tidy.
307: * @throws Exception any exception generated during the test
308: */
309: public void test676205() throws Exception {
310: executeTidyTest("676205.html");
311: }
312:
313: /**
314: * test for Tidy [679135] : Crashes while checking attributes.
315: * @throws Exception any exception generated during the test
316: */
317: public void test679135() throws Exception {
318: executeTidyTest("679135.html");
319: }
320:
321: /**
322: * test for Tidy [696799] : Crash: <script language="">.
323: * @throws Exception any exception generated during the test
324: */
325: public void test696799() throws Exception {
326: executeTidyTest("696799.html");
327: }
328:
329: /**
330: * test for Tidy [788031] : tidy hangs on input.
331: * @throws Exception any exception generated during the test
332: */
333: public void test788031() throws Exception {
334: executeTidyTest("788031.html");
335: }
336:
337: /**
338: * test for Tidy [837023] : segfault on doctype-like element.
339: * @throws Exception any exception generated during the test
340: */
341: public void test837023() throws Exception {
342: executeTidyTest("837023.html");
343: }
344:
345: /**
346: * test for Tidy [991469] : goes wrong with option tag.
347: * @throws Exception any exception generated during the test
348: */
349: public void test991469() throws Exception {
350: executeTidyTest("991469.xml");
351: }
352:
353: /**
354: * test for Tidy [991471] : NPE on file with CDATA.
355: * @throws Exception any exception generated during the test
356: */
357: public void test991471() throws Exception {
358: executeTidyTest("991471.xml");
359: }
360:
361: /**
362: * test for Tidy [1003994] : wrong UNEXPECTED_ENDTAG message.
363: * @throws Exception any exception generated during the test
364: */
365: public void test1003994() throws Exception {
366: executeTidyTest("1003994.xml");
367: assertLogDoesntContains("{");
368: }
369:
370: /**
371: * test for JTidy [1020806]: NPE when PPPrint'ing changed DOM tree.
372: * @throws Exception any exception generated during the test
373: */
374: public void test1020806() throws Exception {
375: org.w3c.dom.Document doc = parseDomTest("1020806.html");
376: tidy.pprint(doc, System.out);
377: }
378:
379: /**
380: * test for JTidy [1020806b]: NPE when PPPrint'ing changed DOM tree.
381: * @throws Exception any exception generated during the test
382: */
383: public void test1020806b() throws Exception {
384: org.w3c.dom.Document doc = parseDomTest("1020806b.html");
385: tidy.pprint(doc, System.out);
386: }
387:
388: /**
389: * test for JTidy [1033035]: EOF bug in parseAsp and parsePhp.
390: * @throws Exception any exception generated during the test
391: */
392: public void test1033035() throws Exception {
393: executeTidyTest("1033035.html");
394: }
395:
396: }
|