You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/05/07 04:21:38 UTC
svn commit: r1479753 -
/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Author: sebb
Date: Tue May 7 02:21:38 2013
New Revision: 1479753
URL: http://svn.apache.org/r1479753
Log:
MOre tests
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1479753&r1=1479752&r2=1479753&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Tue May 7 02:21:38 2013
@@ -382,6 +382,16 @@ public class CSVPrinterTest {
}
@Test
+ public void testEOLQuoted() throws IOException {
+ final StringWriter sw = new StringWriter();
+ final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuoteChar('\'').build());
+ printer.print("a\rb\nc");
+ printer.print("x\by\fz");
+ assertEquals("'a\rb\nc',x\by\fz", sw.toString());
+ printer.close();
+ }
+
+ @Test
public void testPlainEscaped() throws IOException {
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuoteChar(null).withEscape('!').build());
@@ -402,6 +412,16 @@ public class CSVPrinterTest {
}
@Test
+ public void testEOLEscaped() throws IOException {
+ final StringWriter sw = new StringWriter();
+ final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuoteChar(null).withEscape('!').build());
+ printer.print("a\rb\nc");
+ printer.print("x\fy\bz");
+ assertEquals("a!rb!nc,x\fy\bz", sw.toString());
+ printer.close();
+ }
+
+ @Test
public void testPlainPlain() throws IOException {
final StringWriter sw = new StringWriter();
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuoteChar(null).build());
@@ -421,4 +441,14 @@ public class CSVPrinterTest {
printer.close();
}
+ @Test
+ public void testEOLPlain() throws IOException {
+ final StringWriter sw = new StringWriter();
+ final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuoteChar(null).build());
+ printer.print("a\rb\nc");
+ printer.print("x\fy\bz");
+ assertEquals("a\rb\nc,x\fy\bz", sw.toString());
+ printer.close();
+ }
+
}