[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/scannersTests TableScannerTest.java,1.15,1.16
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-05-11 20:42:33
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests In directory sc8-pr-cvs1:/tmp/cvs-serv22446/org/htmlparser/tests/scannersTests Modified Files: TableScannerTest.java Log Message: Moved pending bugs to the 'feature request' tracker, and made the failing unit tests execution conditional on the Parser version being >= 1.4. Index: TableScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/TableScannerTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TableScannerTest.java 5 May 2003 03:12:25 -0000 1.15 --- TableScannerTest.java 11 May 2003 20:42:30 -0000 1.16 *************** *** 30,33 **** --- 30,34 ---- import org.htmlparser.Node; + import org.htmlparser.Parser; import org.htmlparser.scanners.TableScanner; import org.htmlparser.tags.TableColumn; *************** *** 35,38 **** --- 36,40 ---- import org.htmlparser.tags.TableTag; import org.htmlparser.tests.ParserTestCase; + import org.htmlparser.util.NodeIterator; import org.htmlparser.util.ParserException; *************** *** 45,49 **** private String createHtmlWithTable() { return ! "<table width=\"100.0%\" align=\"Center\" cellpadding=\"5.0\" cellspacing=\"0.0\" border=\"0.0\">"+ " <tr>" + " <td border=\"0.0\" valign=\"Top\" colspan=\"5\">" + " <img src=\"file:/c:/data/dev/eclipse_workspace/ShoppingServerTests/resources/pictures/fishbowl.jpg\" width=\"446.0\" height=\"335.0\" />" + " </td>" + " <td border=\"0.0\" align=\"Justify\" valign=\"Top\" colspan=\"7\">" + " <span>The best way to improve your refactoring skills is to practice cleaning up poorly-designed code. And we've got just the thing: code we custom-designed to reek of over 90% of the code smells identified in the refactoring literature. This poorly designed code functions correctly, which you can verify by running a full suite of tests against it. Your challenge is to identify the smells in this code, determining which refactoring(s) can help you clean up the smells and implement the refactorings to arrive at a well-designed new version of the code that continues to pass its unit tests. This exercise takes place using our popular class fishbowl. There is a lot to learn from this challenge, so we recommend that you spend as much time on it as possible.
<br /></span>" + " </td>" + " </tr>" + "</table>"; } --- 47,60 ---- private String createHtmlWithTable() { return ! "<table width=\"100.0%\" align=\"Center\" cellpadding=\"5.0\" cellspacing=\"0.0\" border=\"0.0\">"+ ! " <tr>" + ! " <td border=\"0.0\" valign=\"Top\" colspan=\"5\">" + ! " <img src=\"file:/c:/data/dev/eclipse_workspace/ShoppingServerTests/resources/pictures/fishbowl.jpg\" width=\"446.0\" height=\"335.0\" />" + ! " </td>" + ! " <td border=\"0.0\" align=\"Justify\" valign=\"Top\" colspan=\"7\">" + ! " <span>The best way to improve your refactoring skills is to practice cleaning up poorly-designed code. And we've got just the thing: code we custom-designed to reek of over 90% of the code smells identified in the refactoring literature. This poorly designed code functions correctly, which you can verify by running a full suite of tests against it. Your challenge is to identify the smells in this code, determining which refactoring(s) can help you clean up the smells and implement the refactorings to arrive at a well-designed new version of the code that continues to pass its unit tests. This exercise takes place using our popular class fishbowl. There is a lot to learn from this challenge, so we recommend that you spend as much time on it as possible.
<br /></span>" + ! " </td>" + ! " </tr>" + ! "</table>"; } *************** *** 100,102 **** --- 111,135 ---- assertEquals("second table col count",2,tr.getColumnCount()); } + + /** + * Test many unclosed tags (causes heavy recursion). + * See feature request #729259 Increase maximum recursion depth. + * Only perform this test if it's version 1.4 or higher. + */ + public void testRecursionDepth () throws ParserException + { + Parser parser; + String url = "http://htmlparser.sourceforge.net/test/badtable2.html"; + + parser = new Parser (url); + if (1.4 <= Double.parseDouble (parser.getVersion ().substring (0, parser.getVersion ().indexOf (' ')))) + { + parser.registerScanners (); + for (NodeIterator e = parser.elements();e.hasMoreNodes();) + e.nextNode(); + // Note: The test will throw a StackOverFlowException, + // so we are successful if we get to here... + assertTrue ("Crash", true); + } + } } |