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

Function TestCustomAdapterInputs_Issue1594

cel/cel_adapter_test.go:59–527  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestCustomAdapterInputs_Issue1594(t *testing.T) {
60 env, err := NewEnv(
61 Variable("versions", ListType(IntType)),
62 Variable("versionMap", MapType(StringType, IntType)),
63 Variable("intKeyMap", MapType(IntType, IntType)),
64 Variable("customKeyMap", MapType(IntType, IntType)),
65 Variable("dynVersions", DynType),
66 Variable("dynMap", DynType),
67 )
68 if err != nil {
69 t.Fatalf("NewEnv() failed: %v", err)
70 }
71
72 adapter := issue1594Adapter{Adapter: types.DefaultTypeAdapter}
73 v1, v2 := int64(1), int64(2)
74
75 listVariants := []struct {
76 name string
77 list traits.Lister
78 }{
79 {
80 name: "NewDynamicList_Struct",
81 list: types.NewDynamicList(adapter, []issue1594Version{{1}, {2}}),
82 },
83 {
84 name: "NewDynamicList_DirectIfaceStruct",
85 list: types.NewDynamicList(adapter, []issue1594PtrVersion{{&v1}, {&v2}}),
86 },
87 {
88 name: "NewDynamicList_PtrStruct",
89 list: types.NewDynamicList(adapter, []*issue1594Version{{1}, {2}}),
90 },
91 {
92 name: "NewDynamicList_Any",
93 list: types.NewDynamicList(adapter, []any{issue1594Version{1}, issue1594Version{2}}),
94 },
95 {
96 name: "NewDynamicList_Array",
97 list: types.NewDynamicList(adapter, [2]issue1594Version{{1}, {2}}),
98 },
99 {
100 name: "NewList_Struct",
101 list: types.NewList(adapter, []issue1594Version{{1}, {2}}),
102 },
103 {
104 name: "NewList_DirectIfaceStruct",
105 list: types.NewList(adapter, []issue1594PtrVersion{{&v1}, {&v2}}),
106 },
107 {
108 name: "NewList_PtrStruct",
109 list: types.NewList(adapter, []*issue1594Version{{1}, {2}}),
110 },
111 {
112 name: "NewList_Any",
113 list: types.NewList(adapter, []any{issue1594Version{1}, issue1594Version{2}}),
114 },
115 {
116 name: "NewList_RefVal",

Callers

nothing calls this directly

Calls 15

CompileMethod · 0.95
ProgramMethod · 0.95
NewDynamicListFunction · 0.92
NewListFunction · 0.92
IntTypeAlias · 0.92
MaybeSliceListFunction · 0.92
MaybeReverseListFunction · 0.92
NewDynamicMapFunction · 0.92
NewMapFunction · 0.92
StringTypeAlias · 0.92
NewRegistryFunction · 0.92
ComposeTypesFunction · 0.92

Tested by

no test coverage detected