commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaco...@apache.org
Subject svn commit: r1065525 - /commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java
Date Mon, 31 Jan 2011 08:49:23 GMT
Author: jacopoc
Date: Mon Jan 31 08:49:23 2011
New Revision: 1065525

URL: http://svn.apache.org/viewvc?rev=1065525&view=rev
Log:
Test cases for \r and \n line endings (SANDBOX-218).

Modified:
    commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java

Modified: commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java?rev=1065525&r1=1065524&r2=1065525&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/sandbox/csv/trunk/src/test/org/apache/commons/csv/CSVParserTest.java Mon Jan 31
08:49:23 2011
@@ -543,7 +543,21 @@ public class CSVParserTest extends TestC
      String[][] data = parser.getAllValues();
      assertEquals(4, data.length);
     }
-    
+
+    public void testCarriageReturnEndings() throws IOException {
+     String code = "foo\rbaar,\rhello,world\r,kanu";
+     CSVParser parser = new CSVParser(new StringReader(code));
+     String[][] data = parser.getAllValues();
+     assertEquals(4, data.length);
+    }
+
+    public void testLineFeedEndings() throws IOException {
+     String code = "foo\nbaar,\nhello,world\n,kanu";
+     CSVParser parser = new CSVParser(new StringReader(code));
+     String[][] data = parser.getAllValues();
+     assertEquals(4, data.length);
+    }
+
     public void testIgnoreEmptyLines() throws IOException {
       String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
       //String code = "world\r\n\n";



Mime
View raw message