mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
Fixes after review
This commit is contained in:
+1
-1
@@ -345,7 +345,7 @@ func (r *Lexer) fetchString() {
|
||||
isValid, hasEscapes, length := findStringLen(data)
|
||||
if !isValid {
|
||||
r.pos += length
|
||||
r.errParse("missing trailing string literal")
|
||||
r.errParse("unterminated string literal")
|
||||
return
|
||||
}
|
||||
if !hasEscapes {
|
||||
|
||||
@@ -317,17 +317,17 @@ func TestFetchStringUnterminatedString(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
data []byte
|
||||
}{
|
||||
{data: []byte(`"sting without trailing literal`)},
|
||||
{data: []byte(`"sting without trailing quote`)},
|
||||
{data: []byte(`"\"`)},
|
||||
{data: []byte{'"'}},
|
||||
} {
|
||||
l := Lexer{Data: test.data}
|
||||
l.fetchString()
|
||||
if l.pos > len(l.Data) {
|
||||
t.Errorf("pos should not be greater than length of Data")
|
||||
t.Errorf("fetchString(%s): pos should not be greater than length of Data", test.data)
|
||||
}
|
||||
if l.Error() == nil {
|
||||
t.Errorf("fetchString() should add parsing error")
|
||||
t.Errorf("fetchString(%s): should add parsing error", test.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user