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

Function TestCheckInvalidOptSelectMissingArg

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

Source from the content-addressed store, hash-verified

2869}
2870
2871func TestCheckInvalidOptSelectMissingArg(t *testing.T) {
2872 fac := ast.NewExprFactory()
2873 arg1 := fac.NewStruct(1, "Foo", nil)
2874 call := fac.NewCall(2, "_?._", arg1)
2875
2876 // This is not valid syntax, just for illustration purposes.
2877 src := common.NewTextSource("_?._(Foo{})")
2878 parsed := ast.NewAST(call, ast.NewSourceInfo(src))
2879 reg := newTestRegistry(t)
2880 env, err := NewEnv(containers.DefaultContainer, reg)
2881 if err != nil {
2882 t.Fatalf("NewEnv(cont, reg) failed: %v", err)
2883 }
2884 _, iss := Check(parsed, src, env)
2885 if !strings.Contains(iss.ToDisplayString(), "incorrect signature. argument count: 1") {
2886 t.Errorf("got %s, wanted 'incorrect signature. argument count: 1'", iss.ToDisplayString())
2887 }
2888}
2889
2890func TestCheckInvalidLiteral(t *testing.T) {
2891 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