Skip to content
Snippets Groups Projects
Commit 859d9ec9 authored by Kirill Yukhin's avatar Kirill Yukhin
Browse files

Merge branch '1.10' into 2.0

parents 29df7d30 8395287e
No related branches found
No related tags found
No related merge requests found
...@@ -192,6 +192,7 @@ csv_parse_impl(struct csv *csv, const char *s, const char *end, bool firstonly) ...@@ -192,6 +192,7 @@ csv_parse_impl(struct csv *csv, const char *s, const char *end, bool firstonly)
/* end of field */ /* end of field */
csv->state = CSV_LEADING_SPACES; csv->state = CSV_LEADING_SPACES;
csv->bufp -= csv->ending_spaces; csv->bufp -= csv->ending_spaces;
csv->ending_spaces = 0;
if (firstonly) { if (firstonly) {
csv->state = CSV_NEWFIELD; csv->state = CSV_NEWFIELD;
return p; return p;
......
...@@ -36,7 +36,7 @@ local test6_ans = "|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n|none|" .. ...@@ -36,7 +36,7 @@ local test6_ans = "|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n|none|" ..
"lag[ flag ])|\t\n||\t||\t||\t\n" "lag[ flag ])|\t\n||\t||\t||\t\n"
test = tap.test("csv") test = tap.test("csv")
test:plan(11) test:plan(12)
readable = {} readable = {}
readable.read = myread readable.read = myread
...@@ -128,4 +128,9 @@ fio.unlink(file3) ...@@ -128,4 +128,9 @@ fio.unlink(file3)
fio.unlink(file4) fio.unlink(file4)
fio.rmdir(tmpdir) fio.rmdir(tmpdir)
-- gh-3489: crash with ending space and empty field
local res = csv.load('929,N1XDN ,,"Enfield, CT",')
local exp = {{'929', 'N1XDN', '', 'Enfield, CT', ''}}
test:is_deeply(res, exp, 'gh-3489')
test:check() test:check()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment