csv: Applied patch from from Philip Fominykh to fix newline-after-quote bug

db4
Phil Dawes 2008-05-01 11:54:09 +01:00
parent 7140a018b1
commit 59e24e8ab0
2 changed files with 6 additions and 2 deletions

View File

@ -46,9 +46,7 @@ IN: csv.tests
[ "Year,Make,Model\n1997,Ford,E350\n2000,Mercury,Cougar"
<string-reader> csv ] named-unit-test
! !!!!!!!! other tests
[ { { "Phil Dawes" } } ]
@ -65,3 +63,8 @@ IN: csv.tests
"allows setting of delimiting character"
[ { { "foo" "bah" "baz" } } ]
[ "foo\tbah\tbaz\n" <string-reader> CHAR: \t [ csv ] with-delimiter ] named-unit-test
"Quoted field followed immediately by newline"
[ { { "foo" "bar" }
{ "1" "2" } } ]
[ "foo,\"bar\"\n1,2" <string-reader> csv ] named-unit-test

View File

@ -31,6 +31,7 @@ VAR: delimiter
read1 dup
{ { CHAR: " [ , quoted-field ] } ! " is an escaped quote
{ delimiter> [ ] } ! end of quoted field
{ CHAR: \n [ ] }
[ 2drop skip-to-field-end ] ! end of quoted field + padding
} case ;