[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/tagTests AllTests.java,1.42,1.43 AppletTagTest.
Brought to you by:
derrickoswald
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/tests/tagTests Modified Files: AllTests.java AppletTagTest.java BaseHrefTagTest.java BodyTagTest.java CompositeTagTest.java DoctypeTagTest.java EndTagTest.java FormTagTest.java FrameSetTagTest.java FrameTagTest.java ImageTagTest.java InputTagTest.java JspTagTest.java LinkTagTest.java MetaTagTest.java ObjectCollectionTest.java OptionTagTest.java ScriptTagTest.java SelectTagTest.java StyleTagTest.java TagTest.java TextareaTagTest.java TitleTagTest.java package.html Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/AllTests.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** AllTests.java 8 Sep 2003 02:26:31 -0000 1.42 --- AllTests.java 10 Sep 2003 03:38:24 -0000 1.43 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 31,35 **** import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { public AllTests(String name) { --- 31,35 ---- import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { public AllTests(String name) { *************** *** 42,46 **** suite.addTestSuite(ScriptTagTest.class); suite.addTestSuite(ImageTagTest.class); ! suite.addTestSuite(LinkTagTest.class); suite.addTestSuite(TagTest.class); suite.addTestSuite(TitleTagTest.class); --- 42,46 ---- suite.addTestSuite(ScriptTagTest.class); suite.addTestSuite(ImageTagTest.class); ! suite.addTestSuite(LinkTagTest.class); suite.addTestSuite(TagTest.class); suite.addTestSuite(TitleTagTest.class); *************** *** 51,55 **** suite.addTestSuite(AppletTagTest.class); suite.addTestSuite(FrameTagTest.class); ! suite.addTestSuite(FrameSetTagTest.class); suite.addTestSuite(InputTagTest.class); suite.addTestSuite(OptionTagTest.class); --- 51,55 ---- suite.addTestSuite(AppletTagTest.class); suite.addTestSuite(FrameTagTest.class); ! suite.addTestSuite(FrameSetTagTest.class); suite.addTestSuite(InputTagTest.class); suite.addTestSuite(OptionTagTest.class); *************** *** 61,65 **** suite.addTestSuite(BodyTagTest.class); suite.addTestSuite(CompositeTagTest.class); ! return suite; } --- 61,65 ---- suite.addTestSuite(BodyTagTest.class); suite.addTestSuite(CompositeTagTest.class); ! return suite; } Index: AppletTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/AppletTagTest.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AppletTagTest.java 8 Sep 2003 02:26:31 -0000 1.26 --- AppletTagTest.java 10 Sep 2003 03:38:24 -0000 1.27 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 59,69 **** // Check the data in the applet tag AppletTag appletTag = (AppletTag)node[0]; ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } --- 59,69 ---- // Check the data in the applet tag AppletTag appletTag = (AppletTag)node[0]; ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } *************** *** 87,99 **** appletTag.setCodeBase ("htmlparser.sourceforge.net"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"htmlparser.sourceforge.net\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } ! public void testChangeArchive() throws ParserException { String [][]paramsData = {{"Param1","Value1"},{"Name","Somik"},{"Age","23"}}; --- 87,99 ---- appletTag.setCodeBase ("htmlparser.sourceforge.net"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"htmlparser.sourceforge.net\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } ! public void testChangeArchive() throws ParserException { String [][]paramsData = {{"Param1","Value1"},{"Name","Somik"},{"Age","23"}}; *************** *** 115,125 **** appletTag.setArchive ("htmlparser.jar"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"htmlparser.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } --- 115,125 ---- appletTag.setArchive ("htmlparser.jar"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"htmlparser.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } *************** *** 143,153 **** appletTag.setAppletClass ("MyOtherClass.class"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"MyOtherClass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } --- 143,153 ---- appletTag.setAppletClass ("MyOtherClass.class"); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"MyOtherClass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ ! "<PARAM VALUE=\"Value1\" NAME=\"Param1\">\r\n"+ "<PARAM VALUE=\"Somik\" NAME=\"Name\">\r\n"+ "<PARAM VALUE=\"23\" NAME=\"Age\">\r\n"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } *************** *** 177,187 **** appletTag.setAppletParams (paramsMap); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ "<PARAM VALUE=\"Two\" NAME=\"Second\">"+ ! "<PARAM VALUE=\"One\" NAME=\"First\">"+ "<PARAM VALUE=\"3\" NAME=\"Third\">"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } } --- 177,187 ---- appletTag.setAppletParams (paramsMap); // Check the data in the applet tag ! String expectedRawString = "<APPLET CODE=\"Myclass.class\" CODEBASE=\"www.kizna.com\" ARCHIVE=\"test.jar\">\r\n"+ "<PARAM VALUE=\"Two\" NAME=\"Second\">"+ ! "<PARAM VALUE=\"One\" NAME=\"First\">"+ "<PARAM VALUE=\"3\" NAME=\"Third\">"+ "</APPLET>"; ! assertStringEquals("toHTML()",expectedRawString,appletTag.toHtml()); } } Index: BaseHrefTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/BaseHrefTagTest.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** BaseHrefTagTest.java 8 Sep 2003 02:26:31 -0000 1.25 --- BaseHrefTagTest.java 10 Sep 2003 03:38:24 -0000 1.26 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 39,48 **** super(name); } ! public void testConstruction() { BaseHrefTag baseRefTag = new BaseHrefTag(new TagData(0,0,"",""),"http://www.abc.com"); assertEquals("Expected Base URL","http://www.abc.com",baseRefTag.getBaseUrl()); } ! public void testNotHREFBaseTag() throws ParserException { createParser("<base target=\"_top\">"); --- 39,48 ---- super(name); } ! public void testConstruction() { BaseHrefTag baseRefTag = new BaseHrefTag(new TagData(0,0,"",""),"http://www.abc.com"); assertEquals("Expected Base URL","http://www.abc.com",baseRefTag.getBaseUrl()); } ! public void testNotHREFBaseTag() throws ParserException { createParser("<base target=\"_top\">"); Index: BodyTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/BodyTagTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BodyTagTest.java 8 Sep 2003 02:26:31 -0000 1.11 --- BodyTagTest.java 10 Sep 2003 03:38:24 -0000 1.12 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 45,49 **** super(name); } ! protected void setUp() throws Exception { super.setUp(); --- 45,49 ---- super(name); } ! protected void setUp() throws Exception { super.setUp(); *************** *** 55,72 **** bodyTag = (BodyTag) node[4]; } ! public void testToPlainTextString() throws ParserException { // check the label node ! assertEquals("Body","Yahoo!",bodyTag.toPlainTextString()); } public void testToHTML() throws ParserException { ! assertStringEquals("Raw String","<BODY>Yahoo!</BODY>",bodyTag.toHtml()); } public void testToString() throws ParserException { ! assertEquals("Body","BODY: Yahoo!",bodyTag.toString()); } ! public void testAttributes () { --- 55,72 ---- bodyTag = (BodyTag) node[4]; } ! public void testToPlainTextString() throws ParserException { // check the label node ! assertEquals("Body","Yahoo!",bodyTag.toPlainTextString()); } public void testToHTML() throws ParserException { ! assertStringEquals("Raw String","<BODY>Yahoo!</BODY>",bodyTag.toHtml()); } public void testToString() throws ParserException { ! assertEquals("Body","BODY: Yahoo!",bodyTag.toString()); } ! public void testAttributes () { *************** *** 74,78 **** Node node; Hashtable attributes; ! try { --- 74,78 ---- Node node; Hashtable attributes; ! try { *************** *** 101,111 **** } } ! ! public static TestSuite suite() { return new TestSuite(BodyTagTest.class); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {BodyTagTest.class.getName()}); --- 101,111 ---- } } ! ! public static TestSuite suite() { return new TestSuite(BodyTagTest.class); } ! ! public static void main(String[] args) { new junit.awtui.TestRunner().start(new String[] {BodyTagTest.class.getName()}); Index: CompositeTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/CompositeTagTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CompositeTagTest.java 8 Sep 2003 02:26:31 -0000 1.7 --- CompositeTagTest.java 10 Sep 2003 03:38:24 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 56,62 **** parseAndAssertNodeCount(1); TableTag tableTag = (TableTag)node[0]; ! StringNode [] stringNode = tableTag.digupStringNode("Hello World"); ! assertEquals("number of string nodes",1,stringNode.length); assertNotNull("should have found string node",stringNode); --- 56,62 ---- parseAndAssertNodeCount(1); TableTag tableTag = (TableTag)node[0]; ! StringNode [] stringNode = tableTag.digupStringNode("Hello World"); ! assertEquals("number of string nodes",1,stringNode.length); assertNotNull("should have found string node",stringNode); *************** *** 71,75 **** assertSame("should be original table",tableTag,parent); } ! public void testFindPositionOf() throws ParserException { createParser( --- 71,75 ---- assertSame("should be original table",tableTag,parent); } ! public void testFindPositionOf() throws ParserException { createParser( *************** *** 88,94 **** parseAndAssertNodeCount(1); TableTag tableTag = (TableTag)node[0]; ! StringNode [] stringNode = tableTag.digupStringNode("Hello World"); ! assertEquals("number of string nodes",1,stringNode.length); assertNotNull("should have found string node",stringNode); --- 88,94 ---- parseAndAssertNodeCount(1); TableTag tableTag = (TableTag)node[0]; ! StringNode [] stringNode = tableTag.digupStringNode("Hello World"); ! assertEquals("number of string nodes",1,stringNode.length); assertNotNull("should have found string node",stringNode); *************** *** 96,99 **** int pos = parent.findPositionOf(stringNode[0]); assertEquals("position",5,pos); ! } } --- 96,99 ---- int pos = parent.findPositionOf(stringNode[0]); assertEquals("position",5,pos); ! } } Index: DoctypeTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/DoctypeTagTest.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** DoctypeTagTest.java 8 Sep 2003 02:26:31 -0000 1.26 --- DoctypeTagTest.java 10 Sep 2003 03:38:24 -0000 1.27 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com Index: EndTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/EndTagTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** EndTagTest.java 8 Sep 2003 02:26:31 -0000 1.27 --- EndTagTest.java 10 Sep 2003 03:38:24 -0000 1.28 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 43,47 **** createParser("<HTML></HTML>"); // Register the image scanner ! parser.registerScanners(); parseAndAssertNodeCount(2); // The node should be an HTMLLinkTag --- 43,47 ---- createParser("<HTML></HTML>"); // Register the image scanner ! parser.registerScanners(); parseAndAssertNodeCount(2); // The node should be an HTMLLinkTag *************** *** 50,56 **** assertEquals("Raw String","</HTML>",endTag.toHtml()); } ! public void testEndTagFind() { ! String testHtml = "<SCRIPT>document.write(d+\".com\")</SCRIPT>"; int pos = testHtml.indexOf("</SCRIPT>"); --- 50,56 ---- assertEquals("Raw String","</HTML>",endTag.toHtml()); } ! public void testEndTagFind() { ! String testHtml = "<SCRIPT>document.write(d+\".com\")</SCRIPT>"; int pos = testHtml.indexOf("</SCRIPT>"); Index: FormTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/FormTagTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** FormTagTest.java 8 Sep 2003 02:26:31 -0000 1.30 --- FormTagTest.java 10 Sep 2003 03:38:24 -0000 1.31 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 55,64 **** formTag.setFormLocation("http://www.yahoo.com/yahoo/do_not_login.jsp"); ! String expectedHTML = "<FORM ACTION=\"http://www.yahoo.com/yahoo/do_not_login.jsp\" NAME=\"login_form\" ONSUBMIT=\"return CheckData()\" METHOD=\""+FormTag.POST+"\">\r\n"+ FormScannerTest.EXPECTED_FORM_HTML_REST_OF_FORM; assertStringEquals("Raw String",expectedHTML,formTag.toHtml()); } ! public void testToPlainTextString() throws ParserException { createParser(FormScannerTest.FORM_HTML); --- 55,64 ---- formTag.setFormLocation("http://www.yahoo.com/yahoo/do_not_login.jsp"); ! String expectedHTML = "<FORM ACTION=\"http://www.yahoo.com/yahoo/do_not_login.jsp\" NAME=\"login_form\" ONSUBMIT=\"return CheckData()\" METHOD=\""+FormTag.POST+"\">\r\n"+ FormScannerTest.EXPECTED_FORM_HTML_REST_OF_FORM; assertStringEquals("Raw String",expectedHTML,formTag.toHtml()); } ! public void testToPlainTextString() throws ParserException { createParser(FormScannerTest.FORM_HTML); *************** *** 70,74 **** assertStringEquals("Form Tag string representation"," User NamePassword Contents of TextArea",formTag.toPlainTextString()); } ! public void testSearchFor() throws ParserException { createParser(FormScannerTest.FORM_HTML); --- 70,74 ---- assertStringEquals("Form Tag string representation"," User NamePassword Contents of TextArea",formTag.toPlainTextString()); } ! public void testSearchFor() throws ParserException { createParser(FormScannerTest.FORM_HTML); *************** *** 80,86 **** NodeList nodeList = formTag.searchFor("USER NAME"); assertEquals("Should have found nodes",1,nodeList.size()); ! Node[] nodes = nodeList.toNodeArray(); ! assertEquals("Number of nodes found",1,nodes.length); assertType("search result node",StringNode.class,nodes[0]); --- 80,86 ---- NodeList nodeList = formTag.searchFor("USER NAME"); assertEquals("Should have found nodes",1,nodeList.size()); ! Node[] nodes = nodeList.toNodeArray(); ! assertEquals("Number of nodes found",1,nodes.length); assertType("search result node",StringNode.class,nodes[0]); *************** *** 98,107 **** NodeList nodeList = formTag.searchFor("USER NAME",true); assertEquals("Should have not found nodes",0,nodeList.size()); ! nodeList = formTag.searchFor("User Name",true); assertNotNull("Should have not found nodes",nodeList); } ! public void testSearchByName() throws ParserException { createParser(FormScannerTest.FORM_HTML); --- 98,107 ---- NodeList nodeList = formTag.searchFor("USER NAME",true); assertEquals("Should have not found nodes",0,nodeList.size()); ! nodeList = formTag.searchFor("User Name",true); assertNotNull("Should have not found nodes",nodeList); } ! public void testSearchByName() throws ParserException { createParser(FormScannerTest.FORM_HTML); *************** *** 115,122 **** assertNotNull("Should have found the password node",tag); assertType("tag found",InputTag.class,tag); ! } ! /** ! * Bug 713907 reported by Dhaval Udani, erroneous * attributes being reported. */ --- 115,122 ---- assertNotNull("Should have found the password node",tag); assertType("tag found",InputTag.class,tag); ! } ! /** ! * Bug 713907 reported by Dhaval Udani, erroneous * attributes being reported. */ *************** *** 130,134 **** ); parser.registerScanners(); ! FormTag formTag = (FormTag)(parser.extractAllNodesThatAre( FormTag.class --- 130,134 ---- ); parser.registerScanners(); ! FormTag formTag = (FormTag)(parser.extractAllNodesThatAre( FormTag.class Index: FrameSetTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/FrameSetTagTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FrameSetTagTest.java 8 Sep 2003 02:26:31 -0000 1.27 --- FrameSetTagTest.java 10 Sep 2003 03:38:24 -0000 1.28 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 43,47 **** public void testToHTML() throws ParserException{ createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ --- 43,47 ---- public void testToHTML() throws ParserException{ createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ *************** *** 50,59 **** parser.addScanner(new FrameSetScanner("")); parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(1); assertTrue("Node 0 should be End Tag",node[0] instanceof FrameSetTag); FrameSetTag frameSetTag = (FrameSetTag)node[0]; assertStringEquals("HTML Contents", ! "<FRAMESET BORDER=\"0\" ROWS=\"115,*\" FRAMESPACING=\"0\" FRAMEBORDER=\"NO\">\r\n"+ "<FRAME SCROLLING=\"NO\" FRAMEBORDER=\"NO\" SRC=\"demo_bc_top.html\" NAME=\"topFrame\" NORESIZE>\r\n"+ "<FRAME SCROLLING=\"AUTO\" SRC=\"http://www.kizna.com/web_e/\" NAME=\"mainFrame\">\r\n"+ --- 50,59 ---- parser.addScanner(new FrameSetScanner("")); parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(1); assertTrue("Node 0 should be End Tag",node[0] instanceof FrameSetTag); FrameSetTag frameSetTag = (FrameSetTag)node[0]; assertStringEquals("HTML Contents", ! "<FRAMESET BORDER=\"0\" ROWS=\"115,*\" FRAMESPACING=\"0\" FRAMEBORDER=\"NO\">\r\n"+ "<FRAME SCROLLING=\"NO\" FRAMEBORDER=\"NO\" SRC=\"demo_bc_top.html\" NAME=\"topFrame\" NORESIZE>\r\n"+ "<FRAME SCROLLING=\"AUTO\" SRC=\"http://www.kizna.com/web_e/\" NAME=\"mainFrame\">\r\n"+ Index: FrameTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/FrameTagTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FrameTagTest.java 8 Sep 2003 02:26:31 -0000 1.27 --- FrameTagTest.java 10 Sep 2003 03:38:24 -0000 1.28 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 42,51 **** public void testToHTML() throws ParserException { createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ "</frameset>"); parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(4); assertTrue("Node 1 should be Frame Tag",node[1] instanceof FrameTag); --- 42,51 ---- public void testToHTML() throws ParserException { createParser( ! "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+ "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+ "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+ "</frameset>"); parser.addScanner(new FrameScanner("")); ! parseAndAssertNodeCount(4); assertTrue("Node 1 should be Frame Tag",node[1] instanceof FrameTag); *************** *** 53,60 **** FrameTag frameTag1 = (FrameTag)node[1]; ! FrameTag frameTag2 = (FrameTag)node[2]; ! assertStringEquals("Frame 1 toHTML()","<FRAME SCROLLING=\"NO\" FRAMEBORDER=\"NO\" SRC=\"demo_bc_top.html\" NAME=\"topFrame\" NORESIZE>",frameTag1.toHtml()); ! assertStringEquals("Frame 2 toHTML()","<FRAME SCROLLING=\"AUTO\" SRC=\"http://www.kizna.com/web_e/\" NAME=\"mainFrame\">",frameTag2.toHtml()); } } --- 53,60 ---- FrameTag frameTag1 = (FrameTag)node[1]; ! FrameTag frameTag2 = (FrameTag)node[2]; ! assertStringEquals("Frame 1 toHTML()","<FRAME SCROLLING=\"NO\" FRAMEBORDER=\"NO\" SRC=\"demo_bc_top.html\" NAME=\"topFrame\" NORESIZE>",frameTag1.toHtml()); ! assertStringEquals("Frame 2 toHTML()","<FRAME SCROLLING=\"AUTO\" SRC=\"http://www.kizna.com/web_e/\" NAME=\"mainFrame\">",frameTag2.toHtml()); } } Index: ImageTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/ImageTagTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ImageTagTest.java 8 Sep 2003 02:26:31 -0000 1.29 --- ImageTagTest.java 10 Sep 2003 03:38:24 -0000 1.30 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 39,43 **** import org.htmlparser.util.SimpleNodeIterator; ! public class ImageTagTest extends ParserTestCase { public ImageTagTest(String name) { --- 39,43 ---- import org.htmlparser.util.SimpleNodeIterator; ! public class ImageTagTest extends ParserTestCase { public ImageTagTest(String name) { *************** *** 57,61 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag --- 57,61 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag *************** *** 77,81 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag --- 77,81 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag *************** *** 97,101 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag --- 97,101 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLImageTag *************** *** 114,122 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); assertTrue("Node should be a HTMLImageTag",node[0] instanceof ImageTag); ImageTag imageTag = (ImageTag)node[0]; ! assertEquals("Image incorrect","http://www.cj.com/abcd.jpg",imageTag.getImageURL()); } --- 114,122 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); assertTrue("Node should be a HTMLImageTag",node[0] instanceof ImageTag); ImageTag imageTag = (ImageTag)node[0]; ! assertEquals("Image incorrect","http://www.cj.com/abcd.jpg",imageTag.getImageURL()); } *************** *** 133,137 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag --- 133,137 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag *************** *** 145,149 **** // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an ImageTag --- 145,149 ---- // Register the image scanner parser.addScanner(new ImageScanner("-i",new LinkProcessor())); ! parseAndAssertNodeCount(1); // The node should be an ImageTag *************** *** 155,159 **** assertEquals("Width","305",imageTag.getAttribute("width")); } ! /** * See bug #753003 <IMG> within <A> missed when followed by <MAP> --- 155,159 ---- assertEquals("Width","305",imageTag.getAttribute("width")); } ! /** * See bug #753003 <IMG> within <A> missed when followed by <MAP> *************** *** 171,175 **** return (ImageTag) subNode; } ! return null; } --- 171,175 ---- return (ImageTag) subNode; } ! return null; } *************** *** 193,197 **** createParser (html); parser.registerScanners (); ! parseAndAssertNodeCount (1); assertTrue ("Node should be a LinkTag", node[0] instanceof LinkTag); --- 193,197 ---- createParser (html); parser.registerScanners (); ! parseAndAssertNodeCount (1); assertTrue ("Node should be a LinkTag", node[0] instanceof LinkTag); *************** *** 218,222 **** assertTrue ("bad source", "http://i.cnn.net/cnn/images/1.gif".equals (img.getImageURL ())); } ! // see bug #778781 SRC-attribute suppression in IMG-tags // HTML before parse: --- 218,222 ---- assertTrue ("bad source", "http://i.cnn.net/cnn/images/1.gif".equals (img.getImageURL ())); } ! // see bug #778781 SRC-attribute suppression in IMG-tags // HTML before parse: Index: InputTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/InputTagTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** InputTagTest.java 8 Sep 2003 02:26:31 -0000 1.29 --- InputTagTest.java 10 Sep 2003 03:38:24 -0000 1.30 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 40,48 **** private String testHTML = new String("<INPUT type=\"text\" name=\"Google\">"); ! public InputTagTest(String name) { super(name); } ! protected void setUp() throws Exception { --- 40,48 ---- private String testHTML = new String("<INPUT type=\"text\" name=\"Google\">"); ! public InputTagTest(String name) { super(name); } ! protected void setUp() throws Exception { *************** *** 51,56 **** parser.addScanner(new InputTagScanner("-i")); } ! ! public void testToHTML() throws ParserException { parseAndAssertNodeCount(1); --- 51,56 ---- parser.addScanner(new InputTagScanner("-i")); } ! ! public void testToHTML() throws ParserException { parseAndAssertNodeCount(1); *************** *** 60,65 **** assertStringEquals ("HTML String","<INPUT NAME=\"Google\" TYPE=\"text\">",InputTag.toHtml()); } ! ! public void testToString() throws ParserException { parseAndAssertNodeCount(1); --- 60,65 ---- assertStringEquals ("HTML String","<INPUT NAME=\"Google\" TYPE=\"text\">",InputTag.toHtml()); } ! ! public void testToString() throws ParserException { parseAndAssertNodeCount(1); *************** *** 69,73 **** assertEquals("HTML Raw String","INPUT TAG\n--------\nNAME : Google\nTYPE : text\n",InputTag.toString()); } ! /** * Reproduction of bug report 663038 --- 69,73 ---- assertEquals("HTML Raw String","INPUT TAG\n--------\nNAME : Google\nTYPE : text\n",InputTag.toString()); } ! /** * Reproduction of bug report 663038 *************** *** 82,93 **** parseAndAssertNodeCount(1); ! assertTrue("Node 1 should be INPUT Tag", node[0] instanceof InputTag); InputTag InputTag; InputTag = (InputTag) node[0]; ! assertStringEquals("HTML String", "<INPUT CHECKED NAME=\"cbCheck\" TYPE=\"checkbox\">", InputTag.toHtml()); } ! } --- 82,93 ---- parseAndAssertNodeCount(1); ! assertTrue("Node 1 should be INPUT Tag", node[0] instanceof InputTag); InputTag InputTag; InputTag = (InputTag) node[0]; ! assertStringEquals("HTML String", "<INPUT CHECKED NAME=\"cbCheck\" TYPE=\"checkbox\">", InputTag.toHtml()); } ! } Index: JspTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/JspTagTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** JspTagTest.java 8 Sep 2003 02:26:31 -0000 1.29 --- JspTagTest.java 10 Sep 2003 03:38:24 -0000 1.30 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 72,80 **** " else \n"+ " if(transfer.validate(request))\n"+ ! " %><jsp:forward page=\"transferConfirm.jsp\"/><%\n"+ "%>\n"); Parser.setLineSeparator("\r\n"); // Register the Jsp Scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(5); // The first node should be an HTMLJspTag --- 72,80 ---- " else \n"+ " if(transfer.validate(request))\n"+ ! " %><jsp:forward page=\"transferConfirm.jsp\"/><%\n"+ "%>\n"); Parser.setLineSeparator("\r\n"); // Register the Jsp Scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(5); // The first node should be an HTMLJspTag *************** *** 82,86 **** JspTag tag = (JspTag)node[0]; assertStringEquals("Contents of the tag","@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" ",tag.getText()); ! // The second node should be a normal tag assertTrue("Node 2 should be an Tag",node[1] instanceof Tag); --- 82,86 ---- JspTag tag = (JspTag)node[0]; assertStringEquals("Contents of the tag","@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" ",tag.getText()); ! // The second node should be a normal tag assertTrue("Node 2 should be an Tag",node[1] instanceof Tag); *************** *** 101,107 **** " "; assertEquals("Contents of the tag",expected,tag2.getText()); ! } ! /** * Check if the JSP Tag is being correctly recognized. --- 101,107 ---- " "; assertEquals("Contents of the tag",expected,tag2.getText()); ! } ! /** * Check if the JSP Tag is being correctly recognized. *************** *** 134,142 **** " else \n"+ " if(transfer.validate(request))\n"+ ! " %><jsp:forward page=\"transferConfirm.jsp\"/><%\n"+ "%>\n"); Parser.setLineSeparator("\r\n"); // Register the Jsp Scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(5); // The first node should be an HTMLJspTag --- 134,142 ---- " else \n"+ " if(transfer.validate(request))\n"+ ! " %><jsp:forward page=\"transferConfirm.jsp\"/><%\n"+ "%>\n"); Parser.setLineSeparator("\r\n"); // Register the Jsp Scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(5); // The first node should be an HTMLJspTag *************** *** 144,149 **** JspTag tag = (JspTag)node[0]; assertEquals("Raw String of the first JSP tag","<%@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" %>",tag.toHtml()); ! ! // The third node should be an HTMLJspTag assertTrue("Node 2 should be an HTMLJspTag",node[2] instanceof JspTag); --- 144,149 ---- JspTag tag = (JspTag)node[0]; assertEquals("Raw String of the first JSP tag","<%@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" %>",tag.toHtml()); ! ! // The third node should be an HTMLJspTag assertTrue("Node 2 should be an HTMLJspTag",node[2] instanceof JspTag); *************** *** 161,181 **** assertTrue("Node 4 should be an HTMLJspTag",node[4] instanceof JspTag); JspTag tag4 = (JspTag)node[4]; ! expected = "<%\r\n"+ "%>"; assertEquals("Raw String of the fourth JSP tag",expected,tag4.toHtml()); ! } public void testSpecialCharacters() throws ParserException { ! StringBuffer sb1 = new StringBuffer(); ! sb1.append("<% for (i=0;i<j;i++);%>"); createParser(sb1.toString()); ! ! // Register the jsp scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(1); //assertTrue("Node should be a jsp tag",node[1] instanceof HTMLJspTag); ! JspTag jspTag = (JspTag)node[0]; assertEquals("jsp toHTML()","<% for (i=0;i<j;i++);%>",jspTag.toHtml()); ! } --- 161,181 ---- assertTrue("Node 4 should be an HTMLJspTag",node[4] instanceof JspTag); JspTag tag4 = (JspTag)node[4]; ! expected = "<%\r\n"+ "%>"; assertEquals("Raw String of the fourth JSP tag",expected,tag4.toHtml()); ! } public void testSpecialCharacters() throws ParserException { ! StringBuffer sb1 = new StringBuffer(); ! sb1.append("<% for (i=0;i<j;i++);%>"); createParser(sb1.toString()); ! ! // Register the jsp scanner ! parser.addScanner(new JspScanner("-j")); parseAndAssertNodeCount(1); //assertTrue("Node should be a jsp tag",node[1] instanceof HTMLJspTag); ! JspTag jspTag = (JspTag)node[0]; assertEquals("jsp toHTML()","<% for (i=0;i<j;i++);%>",jspTag.toHtml()); ! } Index: LinkTagTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/LinkTagTest.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** LinkTagTest.java 8 Sep 2003 02:26:31 -0000 1.32 --- LinkTagTest.java 10 Sep 2003 03:38:24 -0000 1.33 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 56,60 **** // Register the image scanner parser.addScanner(new LinkScanner("-l")); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag --- 56,60 ---- // Register the image scanner parser.addScanner(new LinkScanner("-l")); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag *************** *** 76,80 **** // Register the image scanner parser.addScanner(new LinkScanner("-l")); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag --- 76,80 ---- // Register the image scanner parser.addScanner(new LinkScanner("-l")); ! parseAndAssertNodeCount(1); // The node should be an HTMLLinkTag *************** *** 83,87 **** assertEquals("The image locn","http://www.google.com/test.html",linkNode.getLink()); } ! /** * The bug ... [truncated message content] |