added tokenizer test for empty quotes

This commit is contained in:
Christopher Ramey 2021-01-18 07:40:56 -09:00
parent cd73181a62
commit 814102fc09
3 changed files with 10 additions and 3 deletions

3
config/testdata/quotes-empty.tok vendored Normal file
View File

@ -0,0 +1,3 @@
one "" three
"" five ""
seven

View File

@ -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
}

View File

@ -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"]]`,