diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-28 01:54:39 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-28 01:54:39 +0900 |
commit | adb12c2c1b2873d8775f55c02f54e6690687f1a2 (patch) | |
tree | 4715e03c051bfca3262b74046b79252d49c069b4 /driver/parser_test.go | |
parent | Add literal pattern syntax and change tree structure syntax (diff) | |
download | cotia-adb12c2c1b2873d8775f55c02f54e6690687f1a2.tar.gz cotia-adb12c2c1b2873d8775f55c02f54e6690687f1a2.tar.xz |
Detect duplicate production errors
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r-- | driver/parser_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/driver/parser_test.go b/driver/parser_test.go index 272a14d..73d8fac 100644 --- a/driver/parser_test.go +++ b/driver/parser_test.go @@ -273,6 +273,48 @@ foo: "foo"; `, specErr: true, }, + // A production must not have a duplicate alternative. + { + specSrc: ` +s + : foo + | foo + ; +foo: "foo"; +`, + specErr: true, + }, + // A production must not have a duplicate alternative. + { + specSrc: ` +a + : foo + ; +b + : + | + ; +foo: "foo"; +`, + specErr: true, + }, + // A production must not have a duplicate alternative. + { + specSrc: ` +a + : foo + ; +b + : bar + ; +a + : foo + ; +foo: "foo"; +bar: "bar"; +`, + specErr: true, + }, } for i, tt := range tests { t.Run(fmt.Sprintf("#%v", i), func(t *testing.T) { |