MCPcopy
hub / github.com/expr-lang/expr / TestCheck_builtin_without_call

Function TestCheck_builtin_without_call

checker/checker_test.go:1092–1112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1090}
1091
1092func TestCheck_builtin_without_call(t *testing.T) {
1093 tests := []struct {
1094 input string
1095 err string
1096 }{
1097 {`len + 1`, "invalid operation: + (mismatched types func(...interface {}) (interface {}, error) and int) (1:5)\n | len + 1\n | ....^"},
1098 {`string.A`, "type func(interface {}) string has no field A (1:8)\n | string.A\n | .......^"},
1099 }
1100
1101 c := new(checker.Checker)
1102 for _, test := range tests {
1103 t.Run(test.input, func(t *testing.T) {
1104 tree, err := parser.Parse(test.input)
1105 require.NoError(t, err)
1106
1107 _, err = c.Check(tree, conf.New(nil))
1108 require.Error(t, err)
1109 require.Equal(t, test.err, err.Error())
1110 })
1111 }
1112}
1113
1114func TestCheck_EmbeddedInterface(t *testing.T) {
1115 t.Run("embedded interface lookup returns compile-error not panic", func(t *testing.T) {

Callers

nothing calls this directly

Calls 8

ParseFunction · 0.92
NoErrorFunction · 0.92
NewFunction · 0.92
ErrorFunction · 0.92
EqualFunction · 0.92
RunMethod · 0.80
CheckMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…