MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestBindingsNonMatch

Function TestBindingsNonMatch

ext/bindings_test.go:192–206  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

190}
191
192func TestBindingsNonMatch(t *testing.T) {
193 env, err := cel.NewEnv(Bindings(), Strings())
194 if err != nil {
195 t.Fatalf("cel.NewEnv(Bindings(), Strings()) failed: %v", err)
196 }
197 nonMatchExpr := `ceel.bind(a, 1, a)`
198 ast, iss := env.Parse(nonMatchExpr)
199 if iss.Err() != nil {
200 t.Fatalf("env.Parse(%v) failed: %v", nonMatchExpr, iss.Err())
201 }
202 if len(ast.SourceInfo().GetMacroCalls()) != 0 {
203 t.Fatalf("env.Parse(%v) performed a macro replacement when none was expected: %v",
204 nonMatchExpr, ast.SourceInfo().GetMacroCalls())
205 }
206}
207
208func TestBindingsInvalidIdent(t *testing.T) {
209 env, err := cel.NewEnv(Bindings(), Strings())

Callers

nothing calls this directly

Calls 6

ParseMethod · 0.95
NewEnvFunction · 0.92
SourceInfoStruct · 0.92
BindingsFunction · 0.85
StringsFunction · 0.85
ErrMethod · 0.80

Tested by

no test coverage detected