diff --git a/config/testdata/quotes-empty.tok b/config/testdata/quotes-empty.tok new file mode 100644 index 0000000..26e6aa0 --- /dev/null +++ b/config/testdata/quotes-empty.tok @@ -0,0 +1,3 @@ +one "" three +"" five "" +seven diff --git a/config/tokenizer.go b/config/tokenizer.go index 44ab978..31b66ce 100644 --- a/config/tokenizer.go +++ b/config/tokenizer.go @@ -131,9 +131,7 @@ func (t *Tokenizer) Scan() bool { end: if t.err == nil || t.err == io.EOF { - if b.Len() > 0 { - t.text = b.String() - } + t.text = b.String() } return t.err == nil } diff --git a/config/tokenizer_test.go b/config/tokenizer_test.go index bf6c31b..8c8db40 100644 --- a/config/tokenizer_test.go +++ b/config/tokenizer_test.go @@ -29,6 +29,12 @@ func TestQuotesMultiline(t *testing.T) { ) } +func TestQuotesEmpty(t *testing.T) { + runTest(t, "quotes-empty", + `[["one","","three"],["","five",""],["seven"]]`, + ) +} + func TestComments(t *testing.T) { runTest(t, "comments", `[[],["one"],[],["two"],[],["three"]]`,