Thread: [Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/lexerTests PageTests.java,1.17,1.18 TagTests.ja
Brought to you by:
derrickoswald
From: Derrick O. <der...@us...> - 2004-07-31 16:43:22
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18039/src/org/htmlparser/tests/lexerTests Modified Files: PageTests.java TagTests.java KitTest.java SourceTests.java Log Message: Remove unused variables and other fixes exposed by turning on compiler warnings. Index: PageTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/PageTests.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PageTests.java 18 Mar 2004 04:04:08 -0000 1.17 --- PageTests.java 31 Jul 2004 16:42:31 -0000 1.18 *************** *** 78,86 **** public void testNull () throws ParserException { - Page page; - try { ! page = new Page ((URLConnection)null); assertTrue ("null value in constructor", false); } --- 78,84 ---- public void testNull () throws ParserException { try { ! new Page ((URLConnection)null); assertTrue ("null value in constructor", false); } *************** *** 92,96 **** try { ! page = new Page ((String)null); assertTrue ("null value in constructor", false); } --- 90,94 ---- try { ! new Page ((String)null); assertTrue ("null value in constructor", false); } *************** *** 108,116 **** String link; URL url; - Page page; link = "http://www.ibm.com/jp/"; url = new URL (link); ! page = new Page (url.openConnection ()); } --- 106,113 ---- String link; URL url; link = "http://www.ibm.com/jp/"; url = new URL (link); ! new Page (url.openConnection ()); } *************** *** 122,126 **** String link; URL url; - Page page; link = "http://www.bigbogosity.org/"; --- 119,122 ---- *************** *** 128,132 **** try { ! page = new Page (url.openConnection ()); } catch (ParserException pe) --- 124,128 ---- try { ! new Page (url.openConnection ()); } catch (ParserException pe) Index: KitTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/KitTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** KitTest.java 24 May 2004 16:18:31 -0000 1.7 --- KitTest.java 31 Jul 2004 16:42:31 -0000 1.8 *************** *** 27,35 **** import java.io.IOException; - import java.io.Reader; import java.net.URL; import java.util.Vector; import javax.swing.text.BadLocationException; - import javax.swing.text.Element; import javax.swing.text.MutableAttributeSet; import javax.swing.text.html.HTML; --- 27,33 ---- *************** *** 91,95 **** { ch = s.charAt (i); ! if (!Character.isWhitespace (ch) && !(160 == (int)ch)) ret.append (ch); } --- 89,93 ---- { ch = s.charAt (i); ! if (!Character.isWhitespace (ch) && !(160 == ch)) ret.append (ch); } *************** *** 130,134 **** for (int i = 0; i < data.length; i++) { ! if (160 == (int)data[i]) sb.append (" "); else --- 128,132 ---- for (int i = 0; i < data.length; i++) { ! if (160 == data[i]) sb.append (" "); else *************** *** 256,260 **** public void handleStartTag (HTML.Tag t, MutableAttributeSet a, int pos) { - StringBuffer sb; String theirs; Node node; --- 254,257 ---- *************** *** 321,325 **** public void handleEndTag (HTML.Tag t, int pos) { - StringBuffer sb; String theirs; Node node; --- 318,321 ---- *************** *** 387,391 **** public void handleSimpleTag (HTML.Tag t, MutableAttributeSet a, int pos) { - StringBuffer sb; String theirs; Node node; --- 383,386 ---- *************** *** 579,583 **** Parser parser; - Element[] elements; if (0 == args.length) --- 574,577 ---- *************** *** 597,601 **** kit = test.getKit (); parser = kit.getParser (); ! parser.parse ((Reader)lexer.getPage ().getSource (), (ParserCallback)test, true); } } --- 591,595 ---- kit = test.getKit (); parser = kit.getParser (); ! parser.parse (lexer.getPage ().getSource (), test, true); } } *************** *** 605,608 **** --- 599,605 ---- * * $Log$ + * Revision 1.8 2004/07/31 16:42:31 derrickoswald + * Remove unused variables and other fixes exposed by turning on compiler warnings. + * * Revision 1.7 2004/05/24 16:18:31 derrickoswald * Part three of a multiphase refactoring. Index: SourceTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/SourceTests.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SourceTests.java 3 Jul 2004 13:56:08 -0000 1.17 --- SourceTests.java 31 Jul 2004 16:42:31 -0000 1.18 *************** *** 250,254 **** Source source; char[] buffer; - int c; int length; --- 250,253 ---- *************** *** 517,521 **** Source source; char[] buffer; - int c; int length; --- 516,519 ---- Index: TagTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/TagTests.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TagTests.java 2 Jul 2004 00:49:30 -0000 1.11 --- TagTests.java 31 Jul 2004 16:42:31 -0000 1.12 *************** *** 26,31 **** package org.htmlparser.tests.lexerTests; - import java.util.HashMap; - import java.util.Map; import org.htmlparser.Node; --- 26,29 ---- *************** *** 79,83 **** "</head>" + "<body bgcolor=\"#FFFFFF\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" link=\"#003399\" vlink=\"#003399\" alink=\"#003399\">"; - private Map results; private int testProgress; --- 77,80 ---- *************** *** 289,293 **** ParsingThread parsingThread [] = new ParsingThread[100]; - results = new HashMap(); testProgress = 0; for (int i=0;i<parsingThread.length;i++) { --- 286,289 ---- *************** *** 350,379 **** class ParsingThread implements Runnable { ! Parser parser; ! int id; ! LinkTag link1, link2; ! boolean result; ! int max; ParsingThread(int id, String testHtml, int max) { ! this.id = id; ! this.max = max; ! this.parser = Parser.createParser(testHtml, null); } public void run() { try { ! result = false; ! Node linkTag [] = parser.extractAllNodesThatAre(LinkTag.class); ! link1 = (LinkTag)linkTag[0]; ! link2 = (LinkTag)linkTag[1]; ! if (id<max/2) { ! if (link1.getLink().equals("/cgi-bin/view_search?query_text=postdate>20020701&txt_clr=White&bg_clr=Red&url=http://localhost/Testing/Report1.html") && ! link2.getLink().equals("http://normallink.com/sometext.html")) ! result = true; } else { ! if (link1.getLink().equals("http://normallink.com/sometext.html") && ! link2.getLink().equals("http://normallink.com/sometext.html")) ! result = true; } } --- 346,376 ---- class ParsingThread implements Runnable { ! Parser mParser; ! int mId; ! LinkTag mLink1; ! LinkTag mLink2; ! boolean mResult; ! int mMax; ParsingThread(int id, String testHtml, int max) { ! mId = id; ! mMax = max; ! mParser = Parser.createParser(testHtml, null); } public void run() { try { ! mResult = false; ! Node linkTag [] = mParser.extractAllNodesThatAre(LinkTag.class); ! mLink1 = (LinkTag)linkTag[0]; ! mLink2 = (LinkTag)linkTag[1]; ! if (mId < mMax / 2) { ! if (mLink1.getLink().equals("/cgi-bin/view_search?query_text=postdate>20020701&txt_clr=White&bg_clr=Red&url=http://localhost/Testing/Report1.html") && ! mLink2.getLink().equals("http://normallink.com/sometext.html")) ! mResult = true; } else { ! if (mLink1.getLink().equals("http://normallink.com/sometext.html") && ! mLink2.getLink().equals("http://normallink.com/sometext.html")) ! mResult = true; } } *************** *** 383,400 **** } finally { ! testProgress += id; } } public LinkTag getLink1() { ! return link1; } public LinkTag getLink2() { ! return link2; } public boolean passed() { ! return result; } } --- 380,397 ---- } finally { ! testProgress += mId; } } public LinkTag getLink1() { ! return (mLink1); } public LinkTag getLink2() { ! return (mLink2); } public boolean passed() { ! return (mResult); } } |