1
0
mirror of https://github.com/danog/liquid.git synced 2024-12-03 13:17:45 +01:00
liquid/expression/parser_test.go
2017-07-04 11:12:40 -04:00

24 lines
506 B
Go

package expression
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
var parseErrorTests = []struct{ in, expected string }{
{"a syntax error", "parse error"},
}
func TestExpressionParseErrors(t *testing.T) {
for i, test := range parseErrorTests {
t.Run(fmt.Sprintf("%02d", i+1), func(t *testing.T) {
expr, err := Parse(test.in)
require.Nilf(t, expr, test.in)
require.Errorf(t, err, test.in, test.in)
require.Containsf(t, err.Error(), test.expected, test.in)
})
}
}