1 May 10:19
csv issue with "foo"\n
From: Philip Fominykh <philip@...>
Subject: csv issue with "foo"\n
Newsgroups: gmane.comp.lang.factor.general
Date: 2008-05-01 08:22:40 GMT
Subject: csv issue with "foo"\n
Newsgroups: gmane.comp.lang.factor.general
Date: 2008-05-01 08:22:40 GMT
Hello,
There is an issue with csv parser, where if a quoted field is followed
immediately by newline, the newline is ignored.
The following test demonstrates the problem; and a fix.
Cheers,
Philip
diff --git a/extra/csv/csv-tests.factor b/extra/csv/csv-tests.factor
index 6ab26c7..858736a 100644
--- a/extra/csv/csv-tests.factor
+++ b/extra/csv/csv-tests.factor
@@ -46,9 +46,11 @@ IN: csv.tests
[ "Year,Make,Model\n1997,Ford,E350\n2000,Mercury,Cougar"
<string-reader> csv ] named-unit-test
-
+"Quoted field followed immediately by newline"
+[ { { "foo" "bar" }
+ { "1" "2" } } ]
+[ "foo,\"bar\"\n1,2" <string-reader> csv ] named-unit-test
-
! !!!!!!!! other tests
[ { { "Phil Dawes" } } ]
diff --git a/extra/csv/csv.factor b/extra/csv/csv.factor
index 3953ce0..b1953f5 100644
(Continue reading)
RSS Feed