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 2008/07/24 21:43:14 UTC
svn commit: r679514 -
/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
Author: ltheussl
Date: Thu Jul 24 12:43:14 2008
New Revision: 679514
URL: http://svn.apache.org/viewvc?rev=679514&view=rev
Log:
[DOXIA-247] Add test cases submitted by David Delbecq
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java?rev=679514&r1=679513&r2=679514&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-confluence/src/test/java/org/apache/maven/doxia/module/confluence/ConfluenceParserTest.java Thu Jul 24 12:43:14 2008
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.Reader;
+import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
@@ -29,6 +30,7 @@
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.TextSink;
+
import org.codehaus.plexus.util.StringUtils;
/**
@@ -340,6 +342,82 @@
assertEquals( 5, result.split( "end:definitionList\n" ).length );
}
+ /**
+ * DOXIA-247
+ *
+ * @throws ParseException
+ */
+ public void testEndBracket()
+ throws ParseException
+ {
+ String document = "Test"
+ + "\n\n* list1"
+ + "\n\n* list2"
+ + "\n\n* list2"
+ + "\n{pre}123{/pre}";
+
+ output = new StringWriter();
+ Sink sink = new TextSink( output );
+
+ /* parsing with additional space at end works */
+ createParser().parse( new StringReader( document + " " ), sink );
+ assertTrue( "generated document should have a size > 0", output.toString().length() > 0 );
+
+ /* parsing with document ending in } should not fail */
+ try
+ {
+ createParser().parse( new StringReader( document ), sink );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ fail( "parsing with document ending in } should not fail" );
+ }
+
+ assertTrue( "generated document should have a size > 0", output.toString().length() > 0 );
+ }
+
+ /**
+ * DOXIA-247
+ *
+ * @throws ParseException
+ */
+ public void testEndBracketInList()
+ throws ParseException
+ {
+ String document1 = "Test"
+ + "\n\n* list1"
+ + "\n\n* list2"
+ + "\n\n* list2{pre}123{/pre} "
+ + "\n123";
+
+ String document2 = "Test"
+ + "\n\n* list1"
+ + "\n\n* list2"
+ + "\n\n* list2{pre}123{/pre}"
+ + "\n123";
+
+ output = new StringWriter();
+ Sink sink = new TextSink( output );
+
+ /* parsing with additional space at end of list item works */
+ createParser().parse( new StringReader( document1 ), sink );
+ assertTrue( "generated document should have a size > 0", output.toString().length() > 0 );
+
+ /* parsing with end of list item ending in } should not fail */
+ try
+ {
+ createParser().parse( new StringReader( document2 ), sink );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ fail( "parsing with end of list item ending in } should not fail" );
+ }
+
+ assertTrue( "generated document should have a size > 0", output.toString().length() > 0 );
+ }
+
private void assertContainsLines( String message, String result, String lines )
{
lines = StringUtils.replace( lines, "\n", EOL );