[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/scannersTests CompositeTagScannerTest.java,1.43
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-10-25 20:25:27
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests In directory sc8-pr-cvs1:/tmp/cvs-serv13708/tests/scannersTests Modified Files: CompositeTagScannerTest.java LinkScannerTest.java Log Message: Clean up the last few failing tests. *** The bar is green again *** Index: CompositeTagScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/CompositeTagScannerTest.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CompositeTagScannerTest.java 21 Oct 2003 02:24:01 -0000 1.43 --- CompositeTagScannerTest.java 25 Oct 2003 20:19:44 -0000 1.44 *************** *** 86,91 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",9,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertStringEquals("html",html,customTag.toHtml()); } --- 86,91 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",9,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertStringEquals("html",html,customTag.toHtml()); } *************** *** 99,104 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertEquals("html",html,customTag.toHtml()); } --- 99,104 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertEquals("html",html,customTag.toHtml()); } *************** *** 115,121 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); ! Node child = customTag.childAt(0); assertType("child",StringNode.class,child); --- 115,120 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); Node child = customTag.childAt(0); assertType("child",StringNode.class,child); *************** *** 265,270 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertStringEquals("html",html + "</custom>",customTag.toHtml()); } --- 264,269 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertStringEquals("html",html + "</custom>",customTag.toHtml()); } *************** *** 278,283 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertStringEquals("html",html + "</custom>",customTag.toHtml()); } --- 277,282 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertStringEquals("html",html + "</custom>",customTag.toHtml()); } *************** *** 291,296 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",1,customTag.tagData.getEndLine()); assertStringEquals("html", html + "</custom>", customTag.toHtml() ); --- 290,295 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",1,customTag.getEndingLineNumber()); assertStringEquals("html", html + "</custom>", customTag.toHtml() ); *************** *** 309,314 **** assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); assertEquals("ending loc of custom tag",17,customTag.elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertStringEquals("1st custom tag", tag1 + "</custom>", customTag.toHtml()); customTag = (CustomTag)node[1]; --- 308,313 ---- assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); assertEquals("ending loc of custom tag",17,customTag.elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertStringEquals("1st custom tag", tag1 + "</custom>", customTag.toHtml()); customTag = (CustomTag)node[1]; *************** *** 334,340 **** assertEquals("starting loc",9,customTag.getStartTag().elementBegin()); assertEquals("ending loc",17,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",1,customTag.tagData.getEndLine()); ! assertStringEquals("another tag html",another,anotherTag.toHtml()); assertStringEquals("custom tag html",custom,customTag.toHtml()); } --- 333,339 ---- assertEquals("starting loc",9,customTag.getStartTag().elementBegin()); assertEquals("ending loc",17,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",1,customTag.getEndingLineNumber()); ! assertStringEquals("another tag html",another + "</another>",anotherTag.toHtml()); assertStringEquals("custom tag html",custom,customTag.toHtml()); } *************** *** 354,359 **** AnotherTag anotherTag = (AnotherTag)customTag.childAt(0); assertEquals("another tag ending loc",17,anotherTag.elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); assertStringEquals("html","<custom><another></another></custom>",customTag.toHtml()); } --- 353,358 ---- AnotherTag anotherTag = (AnotherTag)customTag.childAt(0); assertEquals("another tag ending loc",17,anotherTag.elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); assertStringEquals("html","<custom><another></another></custom>",customTag.toHtml()); } *************** *** 374,379 **** assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! // assertEquals("starting line position",0,customTag.tagData.getStartLine()); ! // assertEquals("ending line position",0,customTag.tagData.getEndLine()); AnotherTag anotherTag = (AnotherTag)customTag.childAt(0); assertEquals("anotherTag child count",1,anotherTag.getChildCount()); --- 373,378 ---- assertEquals("starting loc",0,customTag.getStartTag().elementBegin()); assertEquals("ending loc",8,customTag.getStartTag().elementEnd()); ! assertEquals("starting line position",0,customTag.getStartingLineNumber()); ! assertEquals("ending line position",0,customTag.getEndingLineNumber()); AnotherTag anotherTag = (AnotherTag)customTag.childAt(0); assertEquals("anotherTag child count",1,anotherTag.getChildCount()); *************** *** 506,518 **** return (super.createTag (page, start, end, attributes, startTag, endTag, children)); } - // public Tag createTag( - // TagData tagData, - // CompositeTagData compositeTagData) { - // url = tagData.getUrlBeingParsed(); - // return super.createTag( - // tagData, - // compositeTagData - // ); - // } }); parseAndAssertNodeCount(1); --- 505,508 ---- *************** *** 628,644 **** } ! public static class CustomTag extends CompositeTag { ! // public TagData tagData; ! public CustomTag(/*TagData data, CompositeTagData compositeTagData*/) { ! // super(data.getPage (), data.getTagBegin (), data.getTagEnd (), data.getAttributes (),compositeTagData); ! // tagData = data; ! } } ! public static class AnotherTag extends CompositeTag { ! public AnotherTag(/*TagData data, CompositeTagData compositeTagData*/) { ! // super(data.getPage (), data.getTagBegin (), data.getTagEnd (), data.getAttributes (),compositeTagData); ! } } - } --- 618,627 ---- } ! public static class CustomTag extends CompositeTag ! { } ! public static class AnotherTag extends CompositeTag ! { } } Index: LinkScannerTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/scannersTests/LinkScannerTest.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** LinkScannerTest.java 21 Oct 2003 02:24:01 -0000 1.43 --- LinkScannerTest.java 25 Oct 2003 20:19:44 -0000 1.44 *************** *** 84,89 **** assertTrue("Third node should be a tag",node[2] instanceof Tag); assertTrue("Fourth node should be a link",node[3] instanceof LinkTag); ! assertTrue("Fifth node should be a link",node[4] instanceof LinkTag); ! assertTrue("Sixth node should be a Tag",node[5] instanceof Tag); } --- 84,90 ---- 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 anythin less than 5 characters 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); } |