garydgregory commented on a change in pull request #60: Fix csv 149 195
URL: https://github.com/apache/commons-csv/pull/60#discussion_r383790405
##########
File path: src/test/java/org/apache/commons/csv/CSVParserTest.java
##########
@@ -1281,4 +1283,37 @@ private void validateRecordPosition(final String
lineSeparator) throws IOExcepti
parser.close();
}
+
+ @Test
+ public void parseIssue195andIssue149() throws IOException {
+ String records = "A,B,C,D\r\n"
+ + "a1,b1,c1,d1\r\n"
+ + "a2,b2,c2,d2";
+ CSVFormat format = CSVFormat.RFC4180;
+ format = format.withFirstRecordAsHeader();
+ format = format.withIgnoreEmptyLines();
+ format = format.withTrim();
+ format = format.withQuote('"');
+ CSVParser parser = format.parse(new StringReader(records));
+ try {
+ for (CSVRecord record : parser) {
+ System.out.println(record);
+ }
+ assertEquals(3, parser.getCurrentLineNumber());
+ } finally {
+ parser.close();
+ }
+ String records2 = "A,B,C,D\r\n"
+ + "a1,b1,c1,d1\r\n"
+ + "a2,b2,c2,d2\r\n";
+ CSVParser parser2 = format.parse(new StringReader(records2));
+ try {
+ for (CSVRecord record : parser2) {
+ System.out.println(record);
Review comment:
No console output please.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services