github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/internal/parser/parse_test.go (about) 1 package parse 2 3 import ( 4 "testing" 5 ) 6 7 /* 8 Creation Time: 2020 - Aug - 20 9 Created by: (ehsan) 10 Maintainers: 11 1. Ehsan N. Moosa (E2) 12 Auditor: Ehsan N. Moosa (E2) 13 Copyright Ronak Software Group 2020 14 */ 15 16 var input = ` 17 {{ @model cql }} 18 {{ @tab (x1, x2, x3) }} 19 {{ @view (x3, x1, x2) }} 20 {{ @view ((x1, x2), x3) }} 21 {{ @cnt x1 }} 22 ` 23 24 func TestLexer(t *testing.T) { 25 l := lex("lex1", input) 26 for { 27 i := l.nextItem() 28 if i.tok == ERROR { 29 break 30 } 31 } 32 } 33 34 func TestParse(t *testing.T) { 35 if _, err := Parse("PARSER", input); err != nil { 36 t.Fatal(err) 37 } 38 // for idx, n := range tr.Root.Nodes { 39 // switch n.Type() { 40 // case NodeText: 41 // // t.Log(idx, ": ", "Text", []byte(n.String())) 42 // default: 43 // // t.Log(idx, ": ", n.String()) 44 // 45 // } 46 // 47 // } 48 }