Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3286/tests/lexerTests
Modified Files:
LexerTests.java
Log Message:
Fix bug #880283 Character ">" erroneously inserted by Lexer.
Some jsp tags are now handled in a separate jsp parse in the lexer.
Jsp tags embedded as attributes are still not handled.
Refer to bug #772700 Jsp Tags are not parsed correctly when in quoted attributes,
which is now reversed (i.e. in quotes are OK, outside of quotes causes problems),
but this points out a deficiency in the data structure holding tag contents (attribute lists)
that doesn't provide for tags within attributes.
Index: LexerTests.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/LexerTests.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** LexerTests.java 14 Jan 2004 02:53:47 -0000 1.17
--- LexerTests.java 24 Jan 2004 17:14:20 -0000 1.18
***************
*** 734,737 ****
--- 734,792 ----
}
+ /**
+ * Check for StackOverflow error.
+ */
+ public void testStackOverflow ()
+ throws
+ ParserException
+ {
+ NodeIterator iterator;
+ Node node;
+ String html;
+
+ html = "<a href = \"http://test.com\" />";
+ createParser (html);
+ for (iterator = parser.elements (); iterator.hasMoreNodes (); )
+ {
+ node = iterator.nextNode ();
+ String text = node.toHtml ();
+ assertStringEquals ("no overflow", html, text);
+ }
+ html = "<a href=\"http://test.com\"/>";
+ createParser (html);
+ for (iterator = parser.elements (); iterator.hasMoreNodes (); )
+ {
+ node = iterator.nextNode ();
+ String text = node.toHtml ();
+ assertStringEquals ("no overflow", html, text);
+ }
+ html = "<a href = \"http://test.com\"/>";
+ createParser (html);
+ for (iterator = parser.elements (); iterator.hasMoreNodes (); )
+ {
+ node = iterator.nextNode ();
+ String text = node.toHtml ();
+ assertStringEquals ("no overflow", html, text);
+ }
+ }
+
+ /**
+ * See bug #880283 Character ">" erroneously inserted by Lexer
+ */
+ public void testJsp () throws ParserException
+ {
+ String html;
+ Lexer lexer;
+ Node node;
+
+ html = "<% out.urlEncode('abc') + \"<br>\" + out.urlEncode('xyz') %>";
+ lexer = new Lexer (html);
+ node = lexer.nextNode ();
+ if (node == null)
+ fail ("too few nodes");
+ else
+ assertStringEquals ("bad html", html, node.toHtml());
+ assertNull ("too many nodes", lexer.nextNode ());
+ }
}
|