This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new c025d73 CSV235 - WRONG Implementation for RFC4180
c025d73 is described below
commit c025d73d31ca9c9c467f3bad142ca62d7ebee76b
Author: Sebb <[email protected]>
AuthorDate: Sun Jun 16 13:44:04 2019 +0100
CSV235 - WRONG Implementation for RFC4180
Show that implementation is actually correct
---
src/test/java/org/apache/commons/csv/CSVParserTest.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java
b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index fc46b16..8953e38 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -1179,6 +1179,18 @@ public class CSVParserTest {
assertEquals(Arrays.asList("header1", "header2", "header1"),
record.getParser().getHeaderNames());
}
+ @Test
+ public void testCSV235() throws IOException {
+ final String dqString = "\"aaa\",\"b\"\"bb\",\"ccc\""; //
"aaa","b""bb","ccc"
+ final Iterator<CSVRecord> records = CSVFormat.RFC4180.parse(new
StringReader(dqString)).iterator();
+ final CSVRecord record = records.next();
+ assertFalse(records.hasNext());
+ Assert.assertEquals(3, record.size());
+ assertEquals("aaa", record.get(0));
+ assertEquals("b\"bb", record.get(1));
+ assertEquals("ccc", record.get(2));
+ }
+
private void validateLineNumbers(final String lineSeparator) throws
IOException {
try (final CSVParser parser = CSVParser.parse("a" + lineSeparator +
"b" + lineSeparator + "c",
CSVFormat.DEFAULT.withRecordSeparator(lineSeparator))) {