Browse Source

added tokenizer test for empty quotes

master
Christopher Ramey 3 years ago
parent
commit
814102fc09
  1. 3
      config/testdata/quotes-empty.tok
  2. 4
      config/tokenizer.go
  3. 6
      config/tokenizer_test.go

3
config/testdata/quotes-empty.tok

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

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

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

Loading…
Cancel
Save