[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/utilTests HTMLTagParserTest.java,1.45,1.46
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-29 21:45:40
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests In directory sc8-pr-cvs1:/tmp/cvs-serv30684/tests/utilTests Modified Files: HTMLTagParserTest.java Log Message: Lexer Integration Removed old Parser classes. Removed EndTag, this class was replaced by a call to the new isEndTag() method on the Tag class The StringNode, RemarkNode and tags.Tag class now derive from their lexeme counterparts in lexer.nodes instead of the other way around. The beginnings of a node factory interface are included. This was added so the lexer could return 'visitable' nodes to the parser. The parser acts as it's own node factory, as does the Lexer. The node count for parsing goes up in most cases because every whitespace (i.e. newline) now counts as a StringNode. This has whacked out a lot of the tests that were expecting fewer nodes or a certain type of node at a particular index. Attributes now maintain their order and case. The count of attributes also went up because whitespace is maintained within tags too. The storage in a Vector means the element 0 Attribute is actually the name of the tag, rather than having the $TAGNAME entry in a HashTable. Index: HTMLTagParserTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/HTMLTagParserTest.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** HTMLTagParserTest.java 22 Sep 2003 02:40:14 -0000 1.45 --- HTMLTagParserTest.java 28 Sep 2003 15:33:59 -0000 1.46 *************** *** 29,33 **** package org.htmlparser.tests.utilTests; - import org.htmlparser.parserHelper.TagParser; import org.htmlparser.tags.Tag; import org.htmlparser.tags.data.TagData; --- 29,32 ---- *************** *** 36,40 **** public class HTMLTagParserTest extends ParserTestCase { ! private TagParser tagParser; public HTMLTagParserTest(String name) { --- 35,39 ---- public class HTMLTagParserTest extends ParserTestCase { ! // private TagParser tagParser; public HTMLTagParserTest(String name) { *************** *** 43,64 **** public void testCorrectTag() { ! Tag tag = new Tag(new TagData(0,20,"font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"","<font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\">")); ! tagParser.correctTag(tag); ! assertStringEquals("Corrected Tag","font face=\"Arial,helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"",tag.getText()); } public void testInsertInvertedCommasCorrectly() { ! StringBuffer test = new StringBuffer("a b=c d e = f"); ! StringBuffer result = tagParser.insertInvertedCommasCorrectly(test); ! assertStringEquals("Expected Correction","a b=\"c d\" e=\"f\"",result.toString()); } public void testPruneSpaces() { ! String test = " fdfdf dfdf "; ! assertEquals("Expected Pruned string","fdfdf dfdf",TagParser.pruneSpaces(test)); } protected void setUp() { ! tagParser = new TagParser(new DefaultParserFeedback()); } } --- 42,67 ---- public void testCorrectTag() { ! fail ("not implemented"); ! // Tag tag = new Tag(new TagData(0,20,"font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"","<font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\">")); ! // tagParser.correctTag(tag); ! // assertStringEquals("Corrected Tag","font face=\"Arial,helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"",tag.getText()); } public void testInsertInvertedCommasCorrectly() { ! fail ("not implemented"); ! // StringBuffer test = new StringBuffer("a b=c d e = f"); ! // StringBuffer result = tagParser.insertInvertedCommasCorrectly(test); ! // assertStringEquals("Expected Correction","a b=\"c d\" e=\"f\"",result.toString()); } public void testPruneSpaces() { ! fail ("not implemented"); ! // String test = " fdfdf dfdf "; ! // assertEquals("Expected Pruned string","fdfdf dfdf",TagParser.pruneSpaces(test)); } protected void setUp() { ! fail ("not implemented"); ! // tagParser = new TagParser(new DefaultParserFeedback()); } } |