aboutsummaryrefslogtreecommitdiff
path: root/spec/lexer_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-07-28 23:00:33 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-07-28 23:00:33 +0900
commitd2aaffc083bb1aa54301d0e908be0a0e412af8c9 (patch)
tree5616e785ecafd489c28bab9c558d604cc1e5eaa8 /spec/lexer_test.go
parentCount the number of each line in consecutive lines (diff)
downloadurubu-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.go6
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(),
},