aboutsummaryrefslogtreecommitdiff
path: root/spec/lexer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lexer_test.go')
-rw-r--r--spec/lexer_test.go34
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/lexer_test.go b/spec/lexer_test.go
index 0e7cc89..5f555ec 100644
--- a/spec/lexer_test.go
+++ b/spec/lexer_test.go
@@ -120,9 +120,39 @@ bar // This is the fourth comment.
},
},
{
- caption: "identifiers beginning with an underscore are not allowed because they are used only auto-generated identifiers",
+ caption: "an identifier cannot contain the capital-case letters",
+ src: `Abc`,
+ err: synErrIDInvalidChar,
+ },
+ {
+ caption: "an identifier cannot contain the capital-case letters",
+ src: `Zyx`,
+ err: synErrIDInvalidChar,
+ },
+ {
+ caption: "the underscore cannot be placed at the beginning of an identifier",
src: `_abc`,
- err: synErrAutoGenID,
+ err: synErrIDInvalidUnderscorePos,
+ },
+ {
+ caption: "the underscore cannot be placed at the end of an identifier",
+ src: `abc_`,
+ err: synErrIDInvalidUnderscorePos,
+ },
+ {
+ caption: "the underscore cannot be placed consecutively",
+ src: `a__b`,
+ err: synErrIDConsecutiveUnderscores,
+ },
+ {
+ caption: "the digits cannot be placed at the biginning of an identifier",
+ src: `0abc`,
+ err: synErrIDInvalidDigitsPos,
+ },
+ {
+ caption: "the digits cannot be placed at the biginning of an identifier",
+ src: `9abc`,
+ err: synErrIDInvalidDigitsPos,
},
{
caption: "an unclosed terminal is not a valid token",