aboutsummaryrefslogtreecommitdiff
path: root/spec/lexer_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-06-20 02:52:06 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-06-20 02:52:06 +0900
commitb453a5c93d7ec305d1e664bb24eea2cc77ccc761 (patch)
tree632c0fce4b0ae63e80990e6d0ae7f572b680daa1 /spec/lexer_test.go
parentAdd CLI (diff)
downloadcotia-b453a5c93d7ec305d1e664bb24eea2cc77ccc761.tar.gz
cotia-b453a5c93d7ec305d1e664bb24eea2cc77ccc761.tar.xz
Add syntax of comments
Diffstat (limited to 'spec/lexer_test.go')
-rw-r--r--spec/lexer_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lexer_test.go b/spec/lexer_test.go
index 1edf15c..484ad30 100644
--- a/spec/lexer_test.go
+++ b/spec/lexer_test.go
@@ -33,6 +33,21 @@ func TestLexer_Run(t *testing.T) {
},
},
{
+ caption: "the lexer ignores line comments",
+ src: `
+// This is the first comment.
+foo
+// This is the second comment.
+// This is the third comment.
+bar // This is the fourth comment.
+`,
+ tokens: []*token{
+ newIDToken("foo"),
+ newIDToken("bar"),
+ newEOFToken(),
+ },
+ },
+ {
caption: "an unclosed terminal is not a valid token",
src: `"abc`,
err: synErrUnclosedTerminal,