diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-28 23:00:33 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-28 23:00:33 +0900 |
commit | d2aaffc083bb1aa54301d0e908be0a0e412af8c9 (patch) | |
tree | 5616e785ecafd489c28bab9c558d604cc1e5eaa8 /spec/lexer_test.go | |
parent | Count the number of each line in consecutive lines (diff) | |
download | urubu-d2aaffc083bb1aa54301d0e908be0a0e412af8c9.tar.gz urubu-d2aaffc083bb1aa54301d0e908be0a0e412af8c9.tar.xz |
Add a token position and detailed info to a lexical error message
Diffstat (limited to 'spec/lexer_test.go')
-rw-r--r-- | spec/lexer_test.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/lexer_test.go b/spec/lexer_test.go index 569f278..e016def 100644 --- a/spec/lexer_test.go +++ b/spec/lexer_test.go @@ -24,6 +24,10 @@ func TestLexer_Run(t *testing.T) { return newPositionToken(num, newPosition(1)) } + invalidTok := func(text string) *token { + return newInvalidToken(text, newPosition(1)) + } + tests := []struct { caption string src string @@ -131,7 +135,7 @@ bar // This is the fourth comment. src: `abc!!!def`, tokens: []*token{ idTok("abc"), - newInvalidToken("!!!"), + invalidTok("!!!"), idTok("def"), newEOFToken(), }, |