Thread: [Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/tagTests FormTagTest.java,1.46,1.47 LinkTagTest
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2005-11-12 16:45:02
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13581/tests/tagTests Modified Files: FormTagTest.java LinkTagTest.java Log Message: Update tests for addition of Paragraph tag. Index: FormTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/FormTagTest.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** FormTagTest.java 31 Jul 2004 16:42:31 -0000 1.46 --- FormTagTest.java 12 Nov 2005 16:44:54 -0000 1.47 *************** *** 41,44 **** --- 41,45 ---- import org.htmlparser.tags.LinkTag; import org.htmlparser.tags.OptionTag; + import org.htmlparser.tags.ParagraphTag; import org.htmlparser.tags.SelectTag; import org.htmlparser.tags.TableTag; *************** *** 272,281 **** "</FORM>" ); ! parseAndAssertNodeCount(8); ! assertTrue("Seventh Node is a link",node[6] instanceof LinkTag); ! LinkTag linkTag = (LinkTag)node[6]; assertEquals("Link Text","Yahoo!\n",linkTag.getLinkText()); assertEquals("Link URL","http://www.yahoo.com",linkTag.getLink()); ! assertType("Eigth Node",FormTag.class,node[7]); } --- 273,284 ---- "</FORM>" ); ! parseAndAssertNodeCount(5); ! assertTrue("Fourth Node is a paragraph",node[3] instanceof ParagraphTag); ! ParagraphTag paragraph = (ParagraphTag)node[3]; ! assertTrue("Second Node of paragraph is a link", paragraph.getChildren ().elementAt (1) instanceof LinkTag); ! LinkTag linkTag = (LinkTag)paragraph.getChildren ().elementAt (1); assertEquals("Link Text","Yahoo!\n",linkTag.getLinkText()); assertEquals("Link URL","http://www.yahoo.com",linkTag.getLink()); ! assertType("Fifth Node",FormTag.class,node[4]); } *************** *** 321,324 **** --- 324,328 ---- factory.unregisterTag (new HeadTag ()); factory.unregisterTag (new BodyTag ()); + factory.unregisterTag (new ParagraphTag ()); parser.setNodeFactory (factory); i = 0; Index: LinkTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/LinkTagTest.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** LinkTagTest.java 2 Sep 2004 02:28:14 -0000 1.52 --- LinkTagTest.java 12 Nov 2005 16:44:54 -0000 1.53 *************** *** 378,399 **** public void testErroneousLinkBug() throws ParserException { createParser( ! "<p>Site Comments?<br>" + "<a href=\"mailto:sa...@ne...?subject=Site Comments\">" + "Mail Us" + ! "<a>" + ! "</p>" ); ! parseAndAssertNodeCount(6); ! // The first node should be a Tag ! assertTrue("First node should be a Tag",node[0] instanceof Tag); ! // The second node should be a Text ! assertTrue("Second node should be a Text",node[1] instanceof Text); ! Text stringNode = (Text)node[1]; assertEquals("Text of the Text","Site Comments?",stringNode.getText()); ! assertTrue("Third node should be a tag",node[2] instanceof Tag); ! assertTrue("Fourth node should be a link",node[3] instanceof LinkTag); // LinkScanner.evaluate() says no HREF means it isn't a link: ! assertTrue("Fifth node should be a tag",node[4] instanceof Tag); ! assertTrue("Sixth node should be a tag",node[5] instanceof Tag); } --- 378,395 ---- public void testErroneousLinkBug() throws ParserException { createParser( ! "Site Comments?<br>" + "<a href=\"mailto:sa...@ne...?subject=Site Comments\">" + "Mail Us" + ! "<a>" ); ! parseAndAssertNodeCount(4); ! // The first node should be a Text ! assertTrue("First node should be a Text",node[0] instanceof Text); ! Text stringNode = (Text)node[0]; assertEquals("Text of the Text","Site Comments?",stringNode.getText()); ! assertTrue("Second node should be a tag",node[1] instanceof Tag); ! assertTrue("Third node should be a link",node[2] instanceof LinkTag); // LinkScanner.evaluate() says no HREF means it isn't a link: ! assertTrue("Fourth node should be a tag",node[3] instanceof Tag); } |