mirror of
https://github.com/danog/liquid.git
synced 2024-11-30 06:59:03 +01:00
24 lines
520 B
Go
24 lines
520 B
Go
|
package expressions
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
var parseErrorTests = []struct{ in, expected string }{
|
||
|
{"a | unknown_filter", "undefined filter: unknown_filter"},
|
||
|
}
|
||
|
|
||
|
func TestParseErrors(t *testing.T) {
|
||
|
for i, test := range parseErrorTests {
|
||
|
t.Run(fmt.Sprintf("%02d", i), 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)
|
||
|
})
|
||
|
}
|
||
|
}
|