[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/utilTests CharacterTranslationTest.java,1.41,1.
Brought to you by:
derrickoswald
From: <der...@us...> - 2004-02-09 02:12:55
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9169/src/org/htmlparser/tests/utilTests Modified Files: CharacterTranslationTest.java Log Message: Rework character entity translation. See task 58599 enhance character reference translation. Decode now handles missing semi colons, encoding is more efficient, hexadecimal numeric character entity references are handled and both encoding and decoding make minimal use of substring(). Augmented the tests in CharacterTranslationTest significantly, and merged the Generate class into the tests. Added translate command scripts in bin, which read from stdin and write to stdout. Index: CharacterTranslationTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/utilTests/CharacterTranslationTest.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** CharacterTranslationTest.java 14 Jan 2004 03:20:01 -0000 1.41 --- CharacterTranslationTest.java 9 Feb 2004 02:09:44 -0000 1.42 *************** *** 29,41 **** import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.net.URL; import java.net.URLConnection; import org.htmlparser.tests.ParserTestCase; import org.htmlparser.util.Translate; [...1507 lines suppressed...] ! stimulus.append (character); ! response.append (">"); ! } ! else ! { ! stimulus.append (character); ! response.append (character); ! } ! } ! } ! } ! string = Translate.decode (response.toString ()); ! if (!string.equals (stimulus.toString ())) ! fail ("decoding incorrect:\nexpected \"" + stimulus.toString () + "\"\n decoded \"" + string + "\"\n encoded \"" + response.toString () + "\""); ! stimulus.setLength (0); ! response.setLength (0); ! } ! } } |