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

Function TestCheckInvalidOptSelectMissingArg

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

Source from the content-addressed store, hash-verified

2827}
2828
2829func TestCheckInvalidOptSelectMissingArg(t *testing.T) {
2830 fac := ast.NewExprFactory()
2831 arg1 := fac.NewStruct(1, "Foo", nil)
2832 call := fac.NewCall(2, "_?._", arg1)
2833
2834 // This is not valid syntax, just for illustration purposes.
2835 src := common.NewTextSource("_?._(Foo{})")
2836 parsed := ast.NewAST(call, ast.NewSourceInfo(src))
2837 reg := newTestRegistry(t)
2838 env, err := NewEnv(containers.DefaultContainer, reg)
2839 if err != nil {
2840 t.Fatalf("NewEnv(cont, reg) failed: %v", err)
2841 }
2842 _, iss := Check(parsed, src, env)
2843 if !strings.Contains(iss.ToDisplayString(), "incorrect signature. argument count: 1") {
2844 t.Errorf("got %s, wanted 'incorrect signature. argument count: 1'", iss.ToDisplayString())
2845 }
2846}
2847
2848func TestCheckInvalidLiteral(t *testing.T) {
2849 fac := ast.NewExprFactory()

Callers

nothing calls this directly

Calls 11

NewStructMethod · 0.95
NewCallMethod · 0.95
NewExprFactoryFunction · 0.92
NewTextSourceFunction · 0.92
NewASTFunction · 0.92
NewSourceInfoFunction · 0.92
CheckFunction · 0.85
newTestRegistryFunction · 0.70
NewEnvFunction · 0.70
ContainsMethod · 0.65
ToDisplayStringMethod · 0.45

Tested by

no test coverage detected