maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r771219 - in /maven/doxia/doxia/trunk: doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
Date Mon, 04 May 2009 07:30:25 GMT
Author: ltheussl
Date: Mon May  4 07:30:24 2009
New Revision: 771219

URL: http://svn.apache.org/viewvc?rev=771219&view=rev
Log:
Test case to demonstrate different behavior of XhtmlBaseParser and XdocParser wrt to entities
in section titles (DOXIA-311).

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-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.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=771219&r1=771218&r2=771219&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
Mon May  4 07:30:24 2009
@@ -357,6 +357,46 @@
     }
 
     /** @throws Exception  */
+    public void testEntities()
+        throws Exception
+    {
+        final String text = "<!DOCTYPE test [<!ENTITY foo \"&#x159;\">]>"
+                + "<body><h2>&amp;&foo;</h2><p>&amp;&foo;</p></body>";
+
+
+        parser.setValidate( false );
+        parser.parse( text, sink );
+
+        Iterator it = sink.getEventList().iterator();
+
+        assertEquals( "section1", ( (SinkEventElement) it.next() ).getName() );
+        assertEquals( "sectionTitle1", ( (SinkEventElement) it.next() ).getName() );
+
+        SinkEventElement textEvt = (SinkEventElement) it.next();
+        assertEquals( "text", textEvt.getName() );
+        assertEquals( "&", textEvt.getArgs()[0] );
+
+        textEvt = (SinkEventElement) it.next();
+        assertEquals( "rawText", textEvt.getName() );
+        assertEquals( "&#x159;", textEvt.getArgs()[0] );
+
+        assertEquals( "sectionTitle1_", ( (SinkEventElement) it.next() ).getName() );
+        assertEquals( "paragraph", ( (SinkEventElement) it.next() ).getName() );
+
+        textEvt = (SinkEventElement) it.next();
+        assertEquals( "text", textEvt.getName() );
+        assertEquals( "&", textEvt.getArgs()[0] );
+
+        textEvt = (SinkEventElement) it.next();
+        assertEquals( "rawText", textEvt.getName() );
+        assertEquals( "&#x159;", textEvt.getArgs()[0] );
+
+        assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
+        //assertEquals( "section1_", ( (SinkEventElement) it.next() ).getName() );
+        assertFalse( it.hasNext() );
+    }
+
+    /** @throws Exception  */
     public void testDecoration()
         throws Exception
     {

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java?rev=771219&r1=771218&r2=771219&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocParserTest.java
Mon May  4 07:30:24 2009
@@ -435,14 +435,16 @@
         }
     }
 
-        /** @throws Exception  */
+    /** @throws Exception  */
     public void testEntities()
         throws Exception
     {
-        final String text = "<section name=\"&amp;\" title=\"&amp;\"><p>&amp;</p></section>";
+        final String text = "<!DOCTYPE test [<!ENTITY foo \"&#x159;\">]>"
+                + "<section name=\"&amp;&foo;\" title=\"&amp;&foo;\"><p>&amp;&foo;</p></section>";
 
         SinkEventTestingSink sink = new SinkEventTestingSink();
 
+        parser.setValidate( false );
         parser.parse( text, sink );
 
         Iterator it = sink.getEventList().iterator();
@@ -452,7 +454,8 @@
 
         SinkEventElement textEvt = (SinkEventElement) it.next();
         assertEquals( "text", textEvt.getName() );
-        assertEquals( "&", textEvt.getArgs()[0] );
+        // FIXME: DOXIA-311
+        assertEquals( "&&#x159;", textEvt.getArgs()[0] );
 
         assertEquals( "sectionTitle1_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "paragraph", ( (SinkEventElement) it.next() ).getName() );
@@ -461,6 +464,10 @@
         assertEquals( "text", textEvt.getName() );
         assertEquals( "&", textEvt.getArgs()[0] );
 
+        textEvt = (SinkEventElement) it.next();
+        assertEquals( "rawText", textEvt.getName() );
+        assertEquals( "&#x159;", textEvt.getArgs()[0] );
+
         assertEquals( "paragraph_", ( (SinkEventElement) it.next() ).getName() );
         assertEquals( "section1_", ( (SinkEventElement) it.next() ).getName() );
         assertFalse( it.hasNext() );



Mime
View raw message