From dd93bf1256f40393d1fca4e3a5609396d97641e0 Mon Sep 17 00:00:00 2001 From: alexej-v Date: Fri, 27 Jul 2018 11:03:01 +0300 Subject: [PATCH] Fixes after review --- jlexer/lexer.go | 2 +- jlexer/lexer_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jlexer/lexer.go b/jlexer/lexer.go index 24cec21..51f0566 100644 --- a/jlexer/lexer.go +++ b/jlexer/lexer.go @@ -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 { diff --git a/jlexer/lexer_test.go b/jlexer/lexer_test.go index 2a655dd..3149ce4 100644 --- a/jlexer/lexer_test.go +++ b/jlexer/lexer_test.go @@ -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) } } }