You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2009/03/25 13:54:26 UTC

svn commit: r758242 - in /maven/doxia/doxia/trunk: doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java

Author: ltheussl
Date: Wed Mar 25 12:54:23 2009
New Revision: 758242

URL: http://svn.apache.org/viewvc?rev=758242&view=rev
Log:
Move entity test into core.

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java?rev=758242&r1=758241&r2=758242&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java Wed Mar 25 12:54:23 2009
@@ -296,7 +296,7 @@
         // test EOLs within <pre>: the sink MUST receive a text event for the EOL
         String text = "<pre><a href=\"what.html\">what</a>" + XhtmlBaseParser.EOL
                 + "<a href=\"what.html\">what</a></pre>";
-        sink.reset();
+
         parser.parse( text, sink );
 
         Iterator it = sink.getEventList().iterator();
@@ -311,4 +311,40 @@
         assertEquals( "link_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "verbatim_", ( (SinkEventElement) it.next() ).getName() );
     }
+
+    /** @throws Exception  */
+    public void testDoxia250()
+        throws Exception
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append( "<!DOCTYPE test [" ).append( XhtmlBaseParser.EOL );
+        sb.append( "<!ENTITY foo \"&#x159;\">" ).append( XhtmlBaseParser.EOL );
+        sb.append( "<!ENTITY foo1 \"&nbsp;\">" ).append( XhtmlBaseParser.EOL );
+        sb.append( "<!ENTITY foo2 \"&#x161;\">" ).append( XhtmlBaseParser.EOL );
+        sb.append( "]>" ).append( XhtmlBaseParser.EOL );
+        sb.append( "<b>&foo;&foo1;&foo2;</b>" );
+
+        parser.setValidate( false );
+        parser.parse( sb.toString(), sink );
+
+        Iterator it = sink.getEventList().iterator();
+
+        SinkEventElement event = (SinkEventElement) it.next();
+        assertEquals( "bold", event.getName() );
+
+        event = (SinkEventElement) it.next();
+        assertEquals( "rawText", event.getName() );
+        assertEquals( "&#x159;",  (String) event.getArgs()[0] );
+
+        event = (SinkEventElement) it.next();
+        assertEquals( "rawText", event.getName() );
+        assertEquals( "&nbsp;",  (String) event.getArgs()[0] );
+
+        event = (SinkEventElement) it.next();
+        assertEquals( "rawText", event.getName() );
+        assertEquals( "&#x161;",  (String) event.getArgs()[0] );
+
+        event = (SinkEventElement) it.next();
+        assertEquals( "bold_", event.getName() );
+    }
 }

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java?rev=758242&r1=758241&r2=758242&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java Wed Mar 25 12:54:23 2009
@@ -108,35 +108,4 @@
         assertEquals( "verbatim_", ( (SinkEventElement) it.next() ).getName() );
         assertFalse( it.hasNext() );
     }
-
-    /**
-     * @throws Exception if any
-     */
-    public void testDoxia250()
-        throws Exception
-    {
-        StringBuffer sb = new StringBuffer();
-        sb.append( "<!DOCTYPE test [" ).append( EOL );
-        sb.append( "<!ENTITY   " ).append( EOL ).append( "   foo   " ).append( EOL ).append( "   \"   " )
-          .append( EOL ).append( "   &#x159;   " ).append( EOL ).append( "   \">" ).append( EOL );
-        sb.append( "<!ENTITY   " ).append( EOL ).append( "   foo1   " ).append( EOL ).append( "   \"   " )
-          .append( EOL ).append( "   &nbsp;   " ).append( EOL ).append( "   \">" ).append( EOL );
-        sb.append( "<!ENTITY   " ).append( EOL ).append( "   foo2   " ).append( EOL ).append( "  \"   " )
-          .append( EOL ).append( "   &#x161;   " ).append( EOL ).append( "   \">" ).append( EOL );
-        sb.append( "]>" ).append( EOL );
-        sb.append( "<html><body>&foo;&foo1;&foo2;</body></html>" );
-
-        String text = sb.toString();
-        StringWriter w = new StringWriter();
-        Sink sink = new XhtmlSink( w );
-        XhtmlParser parser = (XhtmlParser) createParser();
-        parser.setValidate( false );
-        parser.parse( text.toString(), sink );
-        sink.close();
-        String result = w.toString();
-
-        assertTrue( result.indexOf( "&#x159;" ) != -1 );
-        assertTrue( result.indexOf( "&nbsp;" ) != -1 );
-        assertTrue( result.indexOf( "&#x161;" ) != -1 );
-    }
 }