diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-09-22 23:36:19 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-09-22 23:36:19 +0900 |
commit | cf4f53332e9d99a3a9eccfe69e70f98769862c3a (patch) | |
tree | 5963589f931d899f2855b5b25919e8368c3575d5 /compiler/parser_test.go | |
parent | Add name field to the lexical specification (diff) | |
download | tre-cf4f53332e9d99a3a9eccfe69e70f98769862c3a.tar.gz tre-cf4f53332e9d99a3a9eccfe69e70f98769862c3a.tar.xz |
Keep the order of AST nodes constant
Diffstat (limited to 'compiler/parser_test.go')
-rw-r--r-- | compiler/parser_test.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/parser_test.go b/compiler/parser_test.go index 30e6130..7c33fb4 100644 --- a/compiler/parser_test.go +++ b/compiler/parser_test.go @@ -1199,8 +1199,11 @@ func TestParse(t *testing.T) { for kind, pattern := range tt.fragments { fragments[kind] = []byte(pattern) } - ast, _, err := parse(map[spec.LexModeKindID][]byte{ - 1: []byte(tt.pattern), + ast, _, err := parse([]*patternEntry{ + { + id: spec.LexModeKindIDMin, + pattern: []byte(tt.pattern), + }, }, fragments) if tt.syntaxError != nil { // printAST(os.Stdout, ast, "", "", false) @@ -1239,8 +1242,11 @@ func TestParse(t *testing.T) { } func TestParse_FollowAndSymbolTable(t *testing.T) { - root, symTab, err := parse(map[spec.LexModeKindID][]byte{ - 1: []byte("(a|b)*abb"), + root, symTab, err := parse([]*patternEntry{ + { + id: spec.LexModeKindIDMin, + pattern: []byte("(a|b)*abb"), + }, }, nil) if err != nil { t.Fatal(err) |