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

Function TestExprDeclToDeclarationInvalid

cel/decls_test.go:706–782  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

704}
705
706func TestExprDeclToDeclarationInvalid(t *testing.T) {
707 tests := []struct {
708 in *exprpb.Decl
709 out string
710 }{
711 {
712 in: &exprpb.Decl{},
713 out: "unsupported decl",
714 },
715 {
716 in: &exprpb.Decl{
717 Name: "bad_var",
718 DeclKind: &exprpb.Decl_Ident{
719 Ident: &exprpb.Decl_IdentDecl{
720 Type: chkdecls.NewListType(&exprpb.Type{}),
721 },
722 },
723 },
724 out: "unsupported type",
725 },
726 {
727 in: &exprpb.Decl{
728 Name: "bad_var",
729 DeclKind: &exprpb.Decl_Ident{
730 Ident: &exprpb.Decl_IdentDecl{
731 Type: chkdecls.Bool,
732 Value: &exprpb.Constant{},
733 },
734 },
735 },
736 out: "unsupported constant",
737 },
738 {
739 in: &exprpb.Decl{
740 Name: "bad_func_return",
741 DeclKind: &exprpb.Decl_Function{
742 Function: &exprpb.Decl_FunctionDecl{
743 Overloads: []*exprpb.Decl_FunctionDecl_Overload{
744 {
745 OverloadId: "bad_overload",
746 ResultType: &exprpb.Type{},
747 },
748 },
749 },
750 },
751 },
752 out: "unsupported type",
753 },
754 {
755 in: &exprpb.Decl{
756 Name: "bad_func_arg",
757 DeclKind: &exprpb.Decl_Function{
758 Function: &exprpb.Decl_FunctionDecl{
759 Overloads: []*exprpb.Decl_FunctionDecl_Overload{
760 {
761 OverloadId: "bad_overload",
762 Params: []*exprpb.Type{{}},
763 ResultType: chkdecls.Dyn,

Callers

nothing calls this directly

Calls 4

ExprDeclToDeclarationFunction · 0.85
StringMethod · 0.65
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected