-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding_test.go
45 lines (40 loc) · 1.25 KB
/
binding_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package tree_sitter_fysh_test
import (
"context"
_ "embed"
"testing"
fysh "github.com/Fysh-Fyve/tree-sitter-fysh"
sitter "github.com/smacker/go-tree-sitter"
"github.com/stretchr/testify/assert"
)
//go:embed add.fysh
var addFysh []byte
func TestGrammar(t *testing.T) {
assert := assert.New(t)
n, err := sitter.ParseCtx(context.Background(), addFysh, fysh.GetLanguage())
assert.NoError(err)
assert.Equal(
"(source_file "+
"(multiline_comment) "+
"(assignment_statement "+
"left: (positive_ident) "+
"right: (positive_literal (scales (one) (one)))) "+
"(expression_statement "+
"(binary_expression "+
"(addition left: (binary_expression "+
"(addition left: (binary_expression "+
"(addition left: (binary_expression "+
"(addition left: (binary_expression "+
"(addition left: (positive_literal (scales (one) (one) (one))) "+
"right: (positive_literal (scales (one) (one))))) "+
"right: (positive_literal (scales (one) (one) (one))))) "+
"right: (negative_literal (scales (one) (zero))))) "+
"(comment) "+
"right: (binary_expression "+
"left: (positive_literal (scales (one) (one))) "+
"right: (positive_literal (scales (one) (one)))))) "+
"right: (positive_ident)))) "+
"(comment))",
n.String(),
)
}