diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-11 01:20:38 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-11 01:20:38 +0900 |
commit | 89f56948422dad3ab0336b1d97a1e2b9d6554349 (patch) | |
tree | a17e305e032a64e8912ce8be90d4ce7f76e89475 /driver/lexer_test.go | |
parent | Update README and godoc (diff) | |
download | tre-89f56948422dad3ab0336b1d97a1e2b9d6554349.tar.gz tre-89f56948422dad3ab0336b1d97a1e2b9d6554349.tar.xz |
Fix a text representation of an error token
This commit fixes a bug that caused the second and subsequent characters of the text representation of an error token to be missing.
Diffstat (limited to 'driver/lexer_test.go')
-rw-r--r-- | driver/lexer_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/driver/lexer_test.go b/driver/lexer_test.go index e819078..f11a9c0 100644 --- a/driver/lexer_test.go +++ b/driver/lexer_test.go @@ -542,7 +542,7 @@ func TestLexer_Next(t *testing.T) { break } testToken(t, eTok, tok) - // t.Logf("token: ID: %v, Match: %+v Text: \"%v\", EOF: %v, Invalid: %v", tok.ID, tok.Match, string(tok.Match), tok.EOF, tok.Invalid) + // t.Logf("token: ID: %v, Match: %+v Text: \"%v\", EOF: %v, Invalid: %v", tok.ID, tok.Match(), tok.Text(), tok.EOF, tok.Invalid) if tok.EOF { break } @@ -558,9 +558,9 @@ func testToken(t *testing.T, expected, actual *Token) { actual.ModeName != actual.ModeName || actual.ID != expected.ID || actual.Kind != expected.Kind || - !bytes.Equal(actual.Match, expected.Match) || + !bytes.Equal(actual.Match(), expected.Match()) || actual.EOF != expected.EOF || actual.Invalid != expected.Invalid { - t.Fatalf(`unexpected token; want: %v ("%v"), got: %v ("%v")`, expected, string(expected.Match), actual, string(actual.Match)) + t.Fatalf(`unexpected token; want: %v ("%v"), got: %v ("%v")`, expected, expected.Text(), actual, actual.Text()) } } |