[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/parserHelperTests RemarkNodeParserTest.java,1.3
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-10-06 01:43:33
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/parserHelperTests In directory sc8-pr-cvs1:/tmp/cvs-serv2828/tests/parserHelperTests Modified Files: RemarkNodeParserTest.java StringParserTest.java Log Message: Updated tests to correspond to new behaviour. Mostly due to changes in order and case of tag contents. Of the forty odd remaining failing tests, the majority comprise altered functionality that needs to be resolved. Index: RemarkNodeParserTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/parserHelperTests/RemarkNodeParserTest.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** RemarkNodeParserTest.java 22 Sep 2003 02:40:08 -0000 1.36 --- RemarkNodeParserTest.java 6 Oct 2003 01:43:28 -0000 1.37 *************** *** 71,83 **** "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(8); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Text of the remarkNode #1"," saved from url=(0022)http://internet.e-mail ",remarkNode.getText()); ! // The sixth node should be a HTMLRemarkNode ! assertTrue("Sixth node should be a HTMLRemarkNode",node[5] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[5]; ! assertEquals("Text of the remarkNode #6","\r\n Whats gonna happen now ?\r\n",remarkNode.getText()); } --- 71,83 ---- "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(15); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a RemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Text of the remarkNode #1"," saved from url=(0022)http://internet.e-mail ",remarkNode.getText()); ! // The tenth node should be a HTMLRemarkNode ! assertTrue("Tenth node should be a RemarkNode",node[9] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[9]; ! assertEquals("Text of the remarkNode #10","\n Whats gonna happen now ?\n",remarkNode.getText()); } *************** *** 94,106 **** "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(8); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Plain Text of the remarkNode #1"," saved from url=(0022)http://internet.e-mail ",remarkNode.toPlainTextString()); ! // The sixth node should be a HTMLRemarkNode ! assertTrue("Sixth node should be a HTMLRemarkNode",node[5] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[5]; ! assertEquals("Plain Text of the remarkNode #6","\r\n Whats gonna happen now ?\r\n",remarkNode.getText()); } --- 94,106 ---- "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(15); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a RemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Plain Text of the remarkNode #1"," saved from url=(0022)http://internet.e-mail ",remarkNode.toPlainTextString()); ! // The tenth node should be a HTMLRemarkNode ! assertTrue("Tenth node should be a RemarkNode",node[9] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[9]; ! assertEquals("Plain Text of the remarkNode #10","\n Whats gonna happen now ?\n",remarkNode.getText()); } *************** *** 118,130 **** "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(8); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertStringEquals("Raw String of the remarkNode #1","<!-- saved from url=(0022)http://internet.e-mail -->",remarkNode.toHtml()); ! // The sixth node should be a HTMLRemarkNode ! assertTrue("Sixth node should be a HTMLRemarkNode",node[5] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[5]; ! assertStringEquals("Raw String of the remarkNode #6","<!--\r\n Whats gonna happen now ?\r\n-->",remarkNode.toHtml()); } --- 118,130 ---- "</TEST>\n"); Parser.setLineSeparator("\r\n"); ! parseAndAssertNodeCount(15); // The first node should be a HTMLRemarkNode ! assertTrue("First node should be a RemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertStringEquals("Raw String of the remarkNode #1","<!-- saved from url=(0022)http://internet.e-mail -->",remarkNode.toHtml()); ! // The tenth node should be a HTMLRemarkNode ! assertTrue("Tenth node should be a RemarkNode",node[9] instanceof RemarkNode); ! remarkNode = (RemarkNode)node[9]; ! assertStringEquals("Raw String of the remarkNode #6","<!--\n Whats gonna happen now ?\n-->",remarkNode.toHtml()); } *************** *** 156,160 **** assertTrue("Node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; ! assertEquals("Expected contents","\r\n",remarkNode.getText()); } --- 156,160 ---- assertTrue("Node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; ! assertEquals("Expected contents","\n\n",remarkNode.getText()); } *************** *** 168,172 **** createParser("<!-->"); parseAndAssertNodeCount(1); ! assertTrue("Node should be a HTMLRemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Expected contents","",remarkNode.getText()); --- 168,172 ---- createParser("<!-->"); parseAndAssertNodeCount(1); ! assertTrue("Node should be a RemarkNode",node[0] instanceof RemarkNode); RemarkNode remarkNode = (RemarkNode)node[0]; assertEquals("Expected contents","",remarkNode.getText()); *************** *** 268,274 **** + "</HTML>\n" ); ! parseAndAssertNodeCount(10); ! assertTrue("Node should be a HTMLRemarkNode but was "+node[7],node[7] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[7]; assertEquals("Remark Node contents"," Id: html-sgml.sgm,v 1.5 1995/05/26 21:29:50 connolly Exp ",remarkNode.getText()); } --- 268,274 ---- + "</HTML>\n" ); ! parseAndAssertNodeCount(18); ! assertTrue("Node should be a RemarkNode but was "+node[12],node[12] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[12]; assertEquals("Remark Node contents"," Id: html-sgml.sgm,v 1.5 1995/05/26 21:29:50 connolly Exp ",remarkNode.getText()); } *************** *** 291,297 **** + "</HTML>\n" ); ! parseAndAssertNodeCount(10); ! assertTrue("Node should be a HTMLRemarkNode but was "+node[7],node[7] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[7]; assertEquals("Remark Node contents"," another -- -- comment ",remarkNode.getText()); } --- 291,297 ---- + "</HTML>\n" ); ! parseAndAssertNodeCount(18); ! assertTrue("Node should be a RemarkNode but was "+node[12],node[12] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[12]; assertEquals("Remark Node contents"," another -- -- comment ",remarkNode.getText()); } *************** *** 314,320 **** + "</HTML>\n" ); ! parseAndAssertNodeCount(10); ! assertTrue("Node should be a HTMLRemarkNode but was "+node[7],node[7] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[7]; assertEquals("Remark Node contents","",remarkNode.getText()); } --- 314,320 ---- + "</HTML>\n" ); ! parseAndAssertNodeCount(18); ! assertTrue("Node should be a RemarkNode but was "+node[12],node[12] instanceof RemarkNode); ! RemarkNode remarkNode = (RemarkNode)node[12]; assertEquals("Remark Node contents","",remarkNode.getText()); } *************** *** 364,368 **** + "</html>\n" ); ! parseAndAssertNodeCount (10); } --- 364,368 ---- + "</html>\n" ); ! parseAndAssertNodeCount (18); } Index: StringParserTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/parserHelperTests/StringParserTest.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** StringParserTest.java 22 Sep 2003 02:40:08 -0000 1.38 --- StringParserTest.java 6 Oct 2003 01:43:28 -0000 1.39 *************** *** 55,60 **** createParser("<HTML><HEAD><TITLE>Google</TITLE>"); parseAndAssertNodeCount(5); ! // The fourth node should be a HTMLStringNode- with the text - Google ! assertTrue("Fourth node should be a HTMLStringNode",node[3] instanceof StringNode); StringNode stringNode = (StringNode)node[3]; assertEquals("Text of the StringNode","Google",stringNode.getText()); --- 55,60 ---- createParser("<HTML><HEAD><TITLE>Google</TITLE>"); parseAndAssertNodeCount(5); ! // The fourth node should be a StringNode- with the text - Google ! assertTrue("Fourth node should be a StringNode",node[3] instanceof StringNode); StringNode stringNode = (StringNode)node[3]; assertEquals("Text of the StringNode","Google",stringNode.getText()); *************** *** 77,82 **** parser.addScanner(new LinkScanner("-l")); parseAndAssertNodeCount(3); ! // The first node should be a HTMLStringNode- with the text - view these documents, you must have ! assertTrue("First node should be a HTMLStringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("Text of the StringNode","view these documents, you must have ",stringNode.getText()); --- 77,82 ---- parser.addScanner(new LinkScanner("-l")); parseAndAssertNodeCount(3); ! // The first node should be a StringNode- with the text - view these documents, you must have ! assertTrue("First node should be a StringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("Text of the StringNode","view these documents, you must have ",stringNode.getText()); *************** *** 148,154 **** ); parseAndAssertNodeCount(3); ! assertTrue("First node should be HTMLStringNode",node[0] instanceof StringNode); ! assertTrue("Second node should be HTMLRemarkNode",node[1] instanceof RemarkNode); ! assertTrue("Third node should be HTMLStringNode",node[2] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("First String node contents","Before Comment ",stringNode.getText()); --- 148,154 ---- ); parseAndAssertNodeCount(3); ! assertTrue("First node should be StringNode",node[0] instanceof StringNode); ! assertTrue("Second node should be RemarkNode",node[1] instanceof RemarkNode); ! assertTrue("Third node should be StringNode",node[2] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("First String node contents","Before Comment ",stringNode.getText()); *************** *** 167,171 **** createParser("a"); parseAndAssertNodeCount(1); ! assertTrue("First node should be HTMLStringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("First String node contents","a",stringNode.getText()); --- 167,171 ---- createParser("a"); parseAndAssertNodeCount(1); ! assertTrue("First node should be StringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; assertEquals("First String node contents","a",stringNode.getText()); *************** *** 173,181 **** public void testStringWithEmptyLine() throws ParserException { ! createParser("a\n\nb"); parseAndAssertNodeCount(1); ! assertTrue("First node should be HTMLStringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; ! assertStringEquals("First String node contents","a\r\n\r\nb",stringNode.getText()); } --- 173,182 ---- public void testStringWithEmptyLine() throws ParserException { ! String text = "a\n\nb"; ! createParser(text); parseAndAssertNodeCount(1); ! assertTrue("First node should be StringNode",node[0] instanceof StringNode); StringNode stringNode = (StringNode)node[0]; ! assertStringEquals("First String node contents",text,stringNode.getText()); } *************** *** 218,226 **** public void testStringWithLineBreaks() throws Exception { ! createParser("Testing &\nRefactoring"); parseAndAssertNodeCount(1); assertType("first node",StringNode.class,node[0]); StringNode stringNode = (StringNode)node[0]; ! assertStringEquals("text","Testing &\r\nRefactoring",stringNode.toPlainTextString()); } --- 219,228 ---- public void testStringWithLineBreaks() throws Exception { ! String text = "Testing &\nRefactoring"; ! createParser(text); parseAndAssertNodeCount(1); assertType("first node",StringNode.class,node[0]); StringNode stringNode = (StringNode)node[0]; ! assertStringEquals("text",text,stringNode.toPlainTextString()); } |