1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 13:54:41 +01:00
liquid/expression_parser_test.go

38 lines
744 B
Go
Raw Normal View History

2017-06-25 18:36:28 +02:00
//go:generate ragel -Z scanner.rl
package main
import (
"fmt"
"os"
"testing"
"github.com/stretchr/testify/require"
)
// var lexerTests = []struct{}{
// {"{{var}}", "value"},
// {"{{x}}", "1"},
// }
func TestExpressionParser(t *testing.T) {
tokens, err := ScanExpression("abc > 123")
require.NoError(t, err)
fmt.Println("tokens =", tokens)
// ast, err := Parse(tokens)
// require.NoError(t, err)
// fmt.Println("ast =", ast)
// err = ast.Render(os.Stdout, nil)
// require.NoError(t, err)
// fmt.Println()
return
for _, test := range chunkTests {
tokens := ScanChunks(test.in, "")
ast, err := Parse(tokens)
require.NoError(t, err)
actual := ast.Render(os.Stdout, nil)
require.Equal(t, test.expected, actual)
}
}