Debian Codegraph @

common/types/provider_test.go

raw symbols SCIP
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package typesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/
16
17 import (
18 "bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/"
19 "fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/"
20 "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/"
21 "sortscip-go gomod github.com/golang/go/src go1.23.0 sort/"
22 "stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/"
23 "testingscip-go gomod github.com/golang/go/src go1.23.0 testing/"
24 "timescip-go gomod github.com/golang/go/src go1.23.0 time/"
25
26 "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/"
27 "github.com/google/cel-go/common/types/traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/"
28 "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/"
29
30 proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/ "github.com/google/cel-go/test/proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/"
31 exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ "google.golang.org/genproto/googleapis/api/expr/v1alpha1scip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/"
32 anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/ "google.golang.org/protobuf/types/known/anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/"
33 dpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/durationpb`/ "google.golang.org/protobuf/types/known/durationpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/durationpb`/"
34 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ "google.golang.org/protobuf/types/known/structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/"
35 tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/ "google.golang.org/protobuf/types/known/timestamppbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/"
36 wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/ "google.golang.org/protobuf/types/known/wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/"
37 )
38
39 func TestRegistryCopyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryCopy().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
40 reg := NewEmptyRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewEmptyRegistry().()
41 reg2 := reg.Copyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#Copy().()
42 if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(reg, reg2) {
43 t.Fatalscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatal().("type registry copy did not produce equivalent values.")
44 }
45 reg = newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
46 reg2 = reg.Copyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#Copy().()
47 if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(reg, reg2) {
48 t.Fatalscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatal().("type registry copy did not produce equivalent values.")
49 }
50 }
51
52 func TestRegistryRegisterTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryRegisterType().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
53 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
54 err := reg.RegisterTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterType().(
55 NewTypeValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeValue().("http.Request", traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.ReceiverTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ReceiverType.),
56 NewObjectTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewObjectType().("http.Request", traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.ReceiverTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ReceiverType.),
57 )
58 if err == nil {
59 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("RegisterType() for differing type definitions with the same name did not fail")
60 }
61 }
62
63 func TestRegistryRegisterTypeNoConflictscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryRegisterTypeNoConflict().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
64 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
65 err := reg.RegisterTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterType().(
66 NewOpaqueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewOpaqueType().("http.Request", NewTypeParamTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeParamType().("T")),
67 NewOpaqueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewOpaqueType().("http.Request", NewTypeParamTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeParamType().("V")),
68 )
69 if err != nil {
70 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("RegisterType() failed for equivalent types: %v", err)
71 }
72 }
73
74 func TestRegistryRegisterTypeConflictscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryRegisterTypeConflict().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
75 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
76 err := reg.RegisterTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterType().(
77 NewOpaqueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewOpaqueType().("http.Request", NewTypeParamTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeParamType().("T"), NewTypeParamTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeParamType().("V")),
78 NewOpaqueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewOpaqueType().("http.Request", NewTypeParamTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewTypeParamType().("V")),
79 )
80 if err == nil {
81 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("RegisterType() for differing type definitions with the same name did not fail")
82 }
83 }
84
85 func TestRegistryEnumValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryEnumValue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
86 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
87 err := reg.RegisterDescriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterDescriptor().(proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.GlobalEnum_GOOscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum_GOO..Descriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum#Descriptor().().ParentFilescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#ParentFile().())
88 if err != nil {
89 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("RegisterDescriptor() failed: %v", err)
90 }
91 enumVal := reg.EnumValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#EnumValue().("google.expr.proto3.test.GlobalEnum.GOO")
92 if Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.GlobalEnum_GOOscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum_GOO..Numberscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum#Number().()) != enumVal.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) {
93 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("enum values were not equal between registry and proto: %v", enumVal)
94 }
95 enumVal2, found := reg.FindIdentscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindIdent().("google.expr.proto3.test.GlobalEnum.GOO")
96 if !found {
97 t.Fatalscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatal().("Ident not found google.expr.proto3.test.GlobalEnum.GOO")
98 }
99 if enumVal.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != enumVal2.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) {
100 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got enum value %v, wanted %v", enumVal2, enumVal)
101 }
102 }
103
104 func TestRegistryFindStructTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryFindStructType().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
105 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
106 err := reg.RegisterDescriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterDescriptor().(proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.GlobalEnum_GOOscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum_GOO..Descriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum#Descriptor().().ParentFilescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#ParentFile().())
107 if err != nil {
108 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("RegisterDescriptor() failed: %v", err)
109 }
110 msgTypeName := ".google.expr.proto3.test.TestAllTypes"
111 exprType, found := reg.FindTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindType().(msgTypeName)
112 if !found {
113 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindType() did not find: %q", msgTypeName)
114 }
115 celType, found := reg.FindStructTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindStructType().(msgTypeName)
116 if !found {
117 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindStructType() did not find %q", msgTypeName)
118 }
119 exprConvType, err := ExprTypeToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ExprTypeToType().(exprType)
120 if err != nil {
121 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("ExprTypeToType(%v) failed: %v", exprType, err)
122 }
123 if !exprConvType.IsExactTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Type#IsExactType().(celType) {
124 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %v type, wanted %v", exprConvType, celType)
125 }
126 _, found = reg.FindTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindType().(msgTypeName + "Undefined")
127 if found {
128 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindType() found: %q", msgTypeName+"Undefined")
129 }
130 _, found = reg.FindStructTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindStructType().(msgTypeName + "Undefined")
131 if found {
132 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindStructType() found: %q", msgTypeName+"Undefined")
133 }
134 }
135
136 func TestRegistryFindStructFieldNamesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryFindStructFieldNames().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
137 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.Declscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/Decl#{}, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.Referencescip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/Reference#{})
138 tests := []struct {
139 typeName string
140 fields []string
141 }{
142 {
143 typeName: "google.api.expr.v1alpha1.Reference",
144 fields: []string{"name", "overload_id", "value"},
145 },
146 {
147 typeName: "google.api.expr.v1alpha1.Decl",
148 fields: []string{"name", "ident", "function"},
149 },
150 {
151 typeName: "invalid.TypeName",
152 fields: []string{},
153 },
154 }
155
156 for _, tst := range tests {
157 tc := tst
158 t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%s", tc.typeName), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
159 fields, _ := reg.FindStructFieldNamesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindStructFieldNames().(tc.typeName)
160 sortscip-go gomod github.com/golang/go/src go1.23.0 sort/.Stringsscip-go gomod github.com/golang/go/src go1.23.0 sort/Strings().(fields)
161 sortscip-go gomod github.com/golang/go/src go1.23.0 sort/.Stringsscip-go gomod github.com/golang/go/src go1.23.0 sort/Strings().(tc.fields)
162 if !reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(fields, tc.fields) {
163 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("got %v, wanted %v", fields, tc.fields)
164 }
165 })
166 }
167 }
168
169 func TestRegistryFindStructFieldTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryFindStructFieldType().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
170 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
171 err := reg.RegisterDescriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#RegisterDescriptor().(proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.GlobalEnum_GOOscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum_GOO..Descriptorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/GlobalEnum#Descriptor().().ParentFilescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#ParentFile().())
172 if err != nil {
173 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("RegisterDescriptor() failed: %v", err)
174 }
175 msgTypeName := ".google.expr.proto3.test.TestAllTypes"
176 tests := []struct {
177 typeName string
178 field string
179 found bool
180 }{
181 {
182 typeName: msgTypeName,
183 field: "single_bool",
184 found: true,
185 },
186 {
187 typeName: msgTypeName,
188 field: "single_nested_message",
189 found: true,
190 },
191 {
192 typeName: msgTypeName,
193 field: "single_nested_message",
194 found: true,
195 },
196 {
197 typeName: msgTypeName,
198 field: "standalone_enum",
199 found: true,
200 },
201 {
202 typeName: msgTypeName,
203 field: "single_duration",
204 found: true,
205 },
206 {
207 typeName: msgTypeName,
208 field: "single_timestamp",
209 found: true,
210 },
211 {
212 typeName: msgTypeName,
213 field: "single_any",
214 found: true,
215 },
216 {
217 typeName: msgTypeName,
218 field: "single_int64_wrapper",
219 found: true,
220 },
221 {
222 typeName: msgTypeName,
223 field: "repeated_bool",
224 found: true,
225 },
226 {
227 typeName: msgTypeName,
228 field: "map_string_string",
229 found: true,
230 },
231 {
232 typeName: msgTypeName,
233 field: "double_bool",
234 found: false,
235 },
236 {
237 typeName: msgTypeName + "Undefined",
238 field: "map_string_string",
239 found: false,
240 },
241 }
242
243 for _, tst := range tests {
244 tc := tst
245 t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%s.%s", tc.typeName, tc.field), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
246 // When the field is expected to be found, test parity of the results
247 if tc.found {
248 refField, found := reg.FindFieldTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindFieldType().(tc.typeName, tc.field)
249 if !found {
250 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindFieldType() did not find: %s.%s", tc.typeName, tc.field)
251 }
252 celField, found := reg.FindStructFieldTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindStructFieldType().(tc.typeName, tc.field)
253 if !found {
254 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("FindStructFieldType() found: %s.%s", tc.typeName, tc.field)
255 }
256 convCelFieldType, err := ExprTypeToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ExprTypeToType().(refField.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/FieldType#Type.)
257 if err != nil {
258 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("ExprTypeToType(%v) failed: %v", refField.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/FieldType#Type., err)
259 }
260 if !convCelFieldType.IsExactTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Type#IsExactType().(celField.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/FieldType#Type.) {
261 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Got %v type, wanted %v", convCelFieldType, celField.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/FieldType#Type.)
262 }
263 return
264 }
265 // When the field is not expected to be round ensure both return not found.
266 if !tc.found {
267 _, found := reg.FindFieldTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindFieldType().(tc.typeName, tc.field)
268 if found {
269 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("FindFieldType() found: %s.%s", tc.typeName, tc.field)
270 }
271 _, found = reg.FindStructFieldTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#FindStructFieldType().(tc.typeName, tc.field)
272 if found {
273 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("FindStructFieldType() found: %s.%s", tc.typeName, tc.field)
274 }
275 }
276 })
277 }
278 }
279
280 func TestRegistryNewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryNewValue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
281 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.SourceInfoscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#{})
282 tests := []struct {
283 typeName string
284 fields map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#
285 out protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#
286 }{
287 {
288 typeName: "google.expr.proto3.test.TestAllTypes",
289 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{},
290 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{},
291 },
292 {
293 typeName: "google.expr.proto3.test.TestAllTypes",
294 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
295 "standalone_enum": Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1),
296 },
297 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
298 StandaloneEnumscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#StandaloneEnum.: proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypes_BARscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_BAR.,
299 },
300 },
301 {
302 typeName: "google.expr.proto3.test.TestAllTypes",
303 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
304 "single_int32_wrapper": Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(123),
305 "single_int64_wrapper": NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.,
306 },
307 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
308 SingleInt32Wrapperscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleInt32Wrapper.: wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int32scip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int32().(123),
309 },
310 },
311 {
312 typeName: "google.expr.proto3.test.TestAllTypes",
313 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
314 "repeated_int64": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().([]int64{3, 2, 1}),
315 },
316 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
317 RepeatedInt64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#RepeatedInt64.: []int64{3, 2, 1},
318 },
319 },
320 {
321 typeName: "google.expr.proto3.test.TestAllTypes",
322 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
323 "single_nested_enum": Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2),
324 },
325 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
326 NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#NestedType.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypes_SingleNestedEnumscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_SingleNestedEnum#{
327 SingleNestedEnumscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_SingleNestedEnum#SingleNestedEnum.: proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypes_BAZscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_BAZ.,
328 },
329 },
330 },
331 {
332 typeName: "google.expr.proto3.test.TestAllTypes",
333 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
334 "single_value": Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.,
335 },
336 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
337 SingleValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleValue.: structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewBoolValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewBoolValue().(true),
338 },
339 },
340 {
341 typeName: "google.expr.proto3.test.TestAllTypes",
342 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
343 "single_value": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().([]any{"hello", 10.2}),
344 },
345 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
346 SingleValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleValue.: structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewListValue().(
347 &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.ListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#{
348 Valuesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#Values.: []*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
349 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("hello"),
350 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewNumberValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewNumberValue().(10.2),
351 },
352 },
353 ),
354 },
355 },
356 {
357 typeName: "google.expr.proto3.test.TestAllTypes",
358 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
359 "repeated_nested_message": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().([]any{
360 &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypes_NestedMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_NestedMessage#{Bbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_NestedMessage#Bb.: 123},
361 }),
362 },
363 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
364 RepeatedNestedMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#RepeatedNestedMessage.: []*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypes_NestedMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_NestedMessage#{{Bbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes_NestedMessage#Bb.: 123}},
365 },
366 },
367 {
368 typeName: "google.expr.proto3.test.TestAllTypes",
369 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
370 "map_int64_nested_type": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[int64]any{
371 1234: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{Payloadscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#Payload.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{SingleInt32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleInt32.: 1234}},
372 }),
373 },
374 out: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{
375 MapInt64NestedTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#MapInt64NestedType.: map[int64]*proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.NestedTestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#{
376 1234: {Payloadscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/NestedTestAllTypes#Payload.: &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{SingleInt32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#SingleInt32.: 1234}},
377 },
378 },
379 },
380 {
381 typeName: "google.api.expr.v1alpha1.SourceInfo",
382 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
383 "location": Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("TestRegistryNewValue"),
384 "line_offsets": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().([]int64{0, 2}),
385 "positions": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[int64]int64{1: 2, 2: 4}),
386 },
387 out: &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.SourceInfoscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#{
388 Locationscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#Location.: "TestRegistryNewValue",
389 LineOffsetsscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#LineOffsets.: []int32{0, 2},
390 Positionsscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#Positions.: map[int64]int32{1: 2, 2: 4},
391 },
392 },
393 }
394 for i, tst := range tests {
395 tc := tst
396 t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%d", i), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
397 out := reg.NewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NewValue().(tc.typeName, tc.fields)
398 if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(out) {
399 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("reg.NewValue(%s, %v) failed: %v", tc.typeName, tc.fields, out)
400 }
401 if !protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Equal().(tc.out, out.Valuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Value.().(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#)) {
402 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("reg.NewValue() got %v, wanted %v", out, tc.out)
403 }
404 })
405 }
406 }
407
408 func TestRegistryNewValueErrorsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryNewValueErrors().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
409 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &proto3pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/.TestAllTypesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/test/proto3pb`/TestAllTypes#{}, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.SourceInfoscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#{})
410 tests := []struct {
411 typeName string
412 fields map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#
413 err string
414 }{
415 {
416 typeName: "google.expr.proto3.test.TestAllType",
417 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{},
418 err: "unknown type",
419 },
420 {
421 typeName: "google.expr.proto3.test.TestAllTypes",
422 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
423 "undefined": Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1),
424 },
425 err: "no such field",
426 },
427 {
428 typeName: "google.expr.proto3.test.TestAllTypes",
429 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
430 "single_int32_wrapper": Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.,
431 },
432 err: "type conversion error",
433 },
434 {
435 typeName: "google.expr.proto3.test.TestAllTypes",
436 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
437 "repeated_int64": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().([]float64{1.0, 2.3}),
438 },
439 err: "type conversion error",
440 },
441 {
442 typeName: "google.expr.proto3.test.TestAllTypes",
443 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
444 "repeated_int64": Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(10),
445 },
446 err: "unsupported field type",
447 },
448 {
449 typeName: "google.expr.proto3.test.TestAllTypes",
450 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
451 "map_string_string": NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.,
452 },
453 err: "unsupported field type",
454 },
455 {
456 typeName: "google.expr.proto3.test.TestAllTypes",
457 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
458 "map_string_string": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[string]int{"hello": 1}),
459 },
460 err: "type conversion error",
461 },
462 {
463 typeName: "google.expr.proto3.test.TestAllTypes",
464 fields: map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
465 "map_string_string": reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(map[int]int{1: 1}),
466 },
467 err: "type conversion error",
468 },
469 }
470 for i, tst := range tests {
471 tc := tst
472 t.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%d", i), func(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
473 out := reg.NewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NewValue().(tc.typeName, tc.fields)
474 if !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(out) {
475 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("reg.NewValue(%s, %v) got %v, wanted error", tc.typeName, tc.fields, out)
476 }
477 err := out.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#)
478 if !stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.23.0 strings/Contains().(err.Error(), tc.err) {
479 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("reg.NewValue() got error %v, wanted error %s", err, tc.err)
480 }
481 })
482 }
483 }
484
485 func TestRegistryGettersscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestRegistryGetters().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
486 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
487 if sourceInfo := reg.NewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NewValue().(
488 "google.api.expr.v1alpha1.SourceInfo",
489 map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
490 "location": Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("TestTypeRegistryGetFieldValue"),
491 "line_offsets": NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []int64{0, 2}),
492 "positions": NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[int64]int64{1: 2, 2: 4}),
493 }); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(sourceInfo) {
494 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(sourceInfo)
495 } else {
496 si := sourceInfo.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#)
497 if loc := si.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("location")); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(loc) {
498 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(loc)
499 } else if loc.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#) != "TestTypeRegistryGetFieldValue" {
500 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Expected %s, got %s", "TestTypeRegistryGetFieldValue", loc)
501 }
502 if pos := si.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("positions")); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(pos) {
503 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(pos)
504 } else if pos.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[int64]int32{1: 2, 2: 4})) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
505 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Expected map[int64]int32, got %v", pos)
506 } else if posKeyVal := pos.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Indexerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#).Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(posKeyVal) {
507 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(posKeyVal)
508 } else if posKeyVal.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != 2 {
509 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Expected value to be int64, not int32")
510 }
511 if offsets := si.Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("line_offsets")); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(offsets) {
512 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(offsets)
513 } else if offset1 := offsets.(traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/.Listerscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Lister#).Getscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/Indexer#Get.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1)); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(offset1) {
514 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(offset1)
515 } else if offset1.(Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#) != 2 {
516 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Expected index 1 to be value 2, was %v", offset1)
517 }
518 }
519 }
520
521 func TestConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestConvertToNative().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
522 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
523
524 // Core type conversion tests.
525 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True., true)
526 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True., Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)
527 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#{Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True., Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}), []any{true, false})
528 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#{Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True., Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True., Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.})
529 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-1), int32(-1))
530 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2), int64(2))
531 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-1))
532 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#{4}), []any{int64(4)})
533 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#{5}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(5)})
534 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(3), uint32(3))
535 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(4), uint64(4))
536 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(5), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(5))
537 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#{4}), []any{uint64(4)})
538 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#{5}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(5)})
539 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(5.5), float32(5.5))
540 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.5), float64(-5.5))
541 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#{-5.5}), []any{-5.5})
542 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#{-5.5}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.5)})
543 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.5), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.5))
544 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"), "hello")
545 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"))
546 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue., structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.)
547 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue., NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
548 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Nullscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#{NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.}), []any{structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.})
549 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Nullscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#{NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.})
550 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("world"), []byte("world"))
551 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("world"), Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("world"))
552 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#{Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("hello")}), []any{[]byte("hello")})
553 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#{Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("hello")}), []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("hello")})
554 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []int64{1, 2, 3}), []int32{1, 2, 3})
555 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)}, timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500))
556 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)}, Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)})
557 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)}, timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0))
558 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)}, Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)})
559 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg,
560 map[int64]int64{1: 1, 2: 1, 3: 1}),
561 map[int32]int32{1: 1, 2: 1, 3: 1})
562
563 // Null conversion tests.
564 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Nullscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#(structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.), structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.)
565
566 // Proto conversion tests.
567 parsedExpr := &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{}
568 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(parsedExpr), parsedExpr)
569
570 // Custom scalars
571 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1), testIntscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt#(1))
572 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1), testInt8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt8#(1))
573 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1), testInt16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt16#(1))
574 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1), testInt32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt32#(1))
575 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1), testInt64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt64#(1))
576 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1), testUintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint#(1))
577 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1), testUint8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint8#(1))
578 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1), testUint16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint16#(1))
579 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1), testUint32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint32#(1))
580 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1), testUint64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint64#(1))
581 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(4.5), testFloat32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat32#(4.5))
582 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.1), testFloat64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat64#(-5.1))
583 expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("foo"), testStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testString#("foo"))
584 }
585
586 func TestNativeToValue_Anyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestNativeToValue_Any().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
587 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
588 // NullValue
589 anyValue, err := NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue..ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#ConvertToNative().(anyValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/anyValueType.)
590 if err != nil {
591 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
592 }
593 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, anyValue, NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
594
595 // Json Struct
596 anyValue, err = anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/New().(
597 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStructValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStructValue().(
598 &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{
599 Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
600 "a": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
601 "b": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
602 },
603 },
604 ),
605 )
606 if err != nil {
607 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
608 }
609 expected := NewJSONStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewJSONStruct().(reg, &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{
610 Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
611 "a": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
612 "b": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
613 },
614 })
615 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, anyValue, expected)
616
617 //Json List
618 anyValue, err = anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/New().(structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewListValue().(
619 &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.ListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#{
620 Valuesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#Values.: []*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
621 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
622 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
623 },
624 },
625 ))
626 if err != nil {
627 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
628 }
629 expectedList := NewJSONListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewJSONList().(reg, &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.ListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#{
630 Valuesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#Values.: []*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
631 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
632 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
633 }})
634 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, anyValue, expectedList)
635
636 // Object
637 pbMessage := exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{
638 SourceInfoscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#SourceInfo.: &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.SourceInfoscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#{
639 LineOffsetsscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/SourceInfo#LineOffsets.: []int32{1, 2, 3}}}
640 anyValue, err = anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/New().(&pbMessage)
641 if err != nil {
642 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
643 }
644 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, anyValue, reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(&pbMessage))
645 }
646
647 func TestNativeToValue_Jsonscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestNativeToValue_Json().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
648 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
649 // Json primitive conversion test.
650 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewBoolValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewBoolValue().(false), Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.)
651 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewNumberValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewNumberValue().(1.1), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(1.1))
652 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewNullValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewNullValue().(), Nullscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#(structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.))
653 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("hello"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"))
654
655 // Json list conversion.
656 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t,
657 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewListValue().(
658 &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.ListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#{
659 Valuesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#Values.: []*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
660 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
661 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
662 },
663 },
664 ),
665 NewJSONListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewJSONList().(reg, &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.ListValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#{
666 Valuesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ListValue#Values.: []*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
667 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
668 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
669 },
670 }))
671
672 // Json struct conversion.
673 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t,
674 structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStructValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStructValue().(
675 &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{
676 Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
677 "a": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
678 "b": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
679 },
680 },
681 ),
682 NewJSONStructscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewJSONStruct().(reg, &structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Structscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#{
683 Fieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Struct#Fields.: map[string]*structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/Value#{
684 "a": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("world"),
685 "b": structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().("five!"),
686 },
687 }))
688
689 // Proto conversion test.
690 parsedExpr := &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{}
691 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, parsedExpr, reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(parsedExpr))
692 }
693
694 func TestNativeToValue_Wrappersscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestNativeToValue_Wrappers().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
695 // Wrapper conversion test.
696 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Boolscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Bool().(true), Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)
697 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.BoolValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/BoolValue#{}, Falsescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/False.)
698 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.BoolValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/BoolValue#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
699 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.BytesValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/BytesValue#{}, Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#{})
700 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Bytesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Bytes().([]byte("hi")), Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("hi"))
701 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.BytesValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/BytesValue#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
702 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.DoubleValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/DoubleValue#{}, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(0.0))
703 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Doublescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Double().(6.4), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(6.4))
704 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.DoubleValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/DoubleValue#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
705 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.FloatValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/FloatValue#{}, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(0.0))
706 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Floatscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Float().(3.0), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(3.0))
707 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.FloatValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/FloatValue#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
708 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int32Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int32Value#{}, IntZeroscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntZero.)
709 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int32scip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int32().(-32), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-32))
710 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int32Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int32Value#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
711 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int64Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int64Value#{}, IntZeroscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntZero.)
712 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int64scip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int64().(-64), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-64))
713 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Int64Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/Int64Value#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
714 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.StringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/StringValue#{}, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#(""))
715 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.Stringscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/String().("hello"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"))
716 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.StringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/StringValue#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
717 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt32Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt32Value#{}, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(0))
718 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt32scip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt32().(32), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(32))
719 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt32Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt32Value#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
720 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt64Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt64Value#{}, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(0))
721 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt64scip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt64().(64), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(64))
722 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, (*wrapperspbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/.UInt64Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/wrapperspb`/UInt64Value#)(nil), NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
723 }
724
725 func TestNativeToValue_Primitivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestNativeToValue_Primitive().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
726 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
727
728 // Core type conversions.
729 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, true, Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)
730 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, int(-10), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-10))
731 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, int32(-1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-1))
732 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, int64(2), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2))
733 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, uint(6), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(6))
734 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, uint32(3), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(3))
735 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, uint64(4), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(4))
736 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, float32(5.5), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(5.5))
737 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, float64(-5.5), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.5))
738 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, "hello", Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"))
739 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, []byte("world"), Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#("world"))
740 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, [4]byte{1, 2, 3, 4}, Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#([]byte{1, 2, 3, 4}))
741 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &[4]byte{1, 2, 3, 4}, Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#([]byte{1, 2, 3, 4}))
742 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500), Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)})
743 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0), Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)})
744 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, dpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/durationpb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/durationpb`/New().(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)), Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#{Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(500)})
745 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/New().(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)), Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: timescip-go gomod github.com/golang/go/src go1.23.0 time/.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Unix().(12345, 0)})
746 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, []int32{1, 2, 3}, NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []int32{1, 2, 3}))
747 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, map[int32]int32{1: 1, 2: 1, 3: 1},
748 NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[int32]int32{1: 1, 2: 1, 3: 1}))
749
750 // Pointers to core types.
751 pBool := true
752 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pBool, Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)
753 pDub32 := float32(2.5)
754 pDub64 := float64(-1000.2)
755 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pDub32, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(2.5))
756 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pDub64, Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-1000.2))
757 pInt := int(1)
758 pInt32 := int32(2)
759 pInt64 := int64(-1000)
760 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pInt, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))
761 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pInt32, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(2))
762 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pInt64, Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-1000))
763 pStr := "hello"
764 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pStr, Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello"))
765 pUint := uint(1)
766 pUint32 := uint32(2)
767 pUint64 := uint64(1000)
768 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pUint, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1))
769 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pUint32, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(2))
770 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &pUint64, Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1000))
771
772 // Pointers to ref.Val extensions of core types.
773 rBool := Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.
774 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rBool, Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True.)
775 rDub := Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(32.1)
776 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rDub, rDub)
777 rInt := Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-12)
778 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rInt, rInt)
779 rStr := Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello")
780 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rStr, rStr)
781 rUint := Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(12405)
782 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rUint, rUint)
783 rBytes := Bytesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bytes#([]byte("hello"))
784 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, &rBytes, rBytes)
785
786 // Extensions to core types.
787 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testIntscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt#(1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))
788 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testInt8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt8#(1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))
789 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testInt16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt16#(1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))
790 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testInt32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt32#(1), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(1))
791 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testInt64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt64#(-100), Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(-100))
792 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testUintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint#(1), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1))
793 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testUint8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint8#(1), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1))
794 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testUint16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint16#(1), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(1))
795 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testUint32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint32#(2), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(2))
796 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testUint64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint64#(3), Uintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Uint#(3))
797 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testFloat32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat32#(4.5), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(4.5))
798 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testFloat64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat64#(-5.1), Doublescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Double#(-5.1))
799 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, testStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testString#("foo"), Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("foo"))
800
801 // Null conversion test.
802 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, nil, NullValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NullValue.)
803 expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t, structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE., Nullscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Null#(structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NullValue_NULL_VALUEscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NullValue_NULL_VALUE.))
804 }
805
806 func TestUnsupportedConversionscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TestUnsupportedConversion().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#) {
807 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t)
808 if val := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(nonConvertiblescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/nonConvertible#{}); !IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(val) {
809 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().("Expected error when converting non-proto struct to proto", val)
810 }
811 }
812
813 func expectValueToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectValueToNative().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#, in refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#, out any) {
814 t.Helperscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Helper().()
815 if val, err := in.ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(out)); err != nil {
816 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(err)
817 } else {
818 var equals bool
819 switch val.(type) {
820 case []byte:
821 equals = bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.23.0 bytes/Equal().(val.([]byte), out.([]byte))
822 case protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#:
823 equals = protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Equal().(val.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#), out.(protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#))
824 case bool, int32, int64, uint32, uint64, float32, float64, string:
825 equals = val == out
826 default:
827 equals = reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(val, out)
828 }
829 if !equals {
830 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Unexpected conversion from expr to proto.\n"+
831 "expected: %T, actual: %T", out, val)
832 }
833 }
834 }
835
836 func expectNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/expectNativeToValue().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#, in any, out refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) {
837 t.Helperscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Helper().()
838 reg := newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t, &exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
839 if val := reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(in); IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(val) {
840 t.Errorscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Error().(val)
841 } else {
842 if val.Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(out) != Truescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/True. {
843 t.Errorfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Errorf().("Unexpected conversion from expr to proto.\n"+
844 "expected: %T, actual: %T", val, out)
845 }
846 }
847 }
848
849 func BenchmarkNativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BenchmarkNativeToValue().(b *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Bscip-go gomod github.com/golang/go/src go1.23.0 testing/B#) {
850 reg, err := NewRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRegistry().()
851 if err != nil {
852 b.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("NewRegistry() failed: %v", err)
853 }
854 inputs := []any{
855 true,
856 false,
857 float32(-1.2),
858 float64(-2.4),
859 1,
860 int32(2),
861 int64(3),
862 "",
863 "hello",
864 Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("hello world"),
865 }
866 for _, in := range inputs {
867 input := in
868 b.Runscip-go gomod github.com/golang/go/src go1.23.0 testing/B#Run().(fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Sprintf().("%T/%v", in, in), func(b *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Bscip-go gomod github.com/golang/go/src go1.23.0 testing/B#) {
869 for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.23.0 testing/B#N.; i++ {
870 reg.NativeToValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NativeToValue().(input)
871 }
872 })
873 }
874 }
875
876 func BenchmarkTypeProviderNewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BenchmarkTypeProviderNewValue().(b *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Bscip-go gomod github.com/golang/go/src go1.23.0 testing/B#) {
877 reg, err := NewRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRegistry().(&exprpbscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/.ParsedExprscip-go gomod google.golang.org/genproto/googleapis/api f6391c0de4c7 `google.golang.org/genproto/googleapis/api/expr/v1alpha1`/ParsedExpr#{})
878 if err != nil {
879 b.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("NewRegistry() failed: %v", err)
880 }
881 for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.23.0 testing/B#N.; i++ {
882 reg.NewValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#NewValue().(
883 "google.api.expr.v1.SourceInfo",
884 map[string]refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{
885 "Location": Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#("BenchmarkTypeProvider_NewValue"),
886 "LineOffsets": NewDynamicListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicList().(reg, []int64{0, 2}),
887 "Positions": NewDynamicMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewDynamicMap().(reg, map[int64]int64{1: 2, 2: 4}),
888 })
889 }
890 }
891
892 func BenchmarkTypeProviderCopyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/BenchmarkTypeProviderCopy().(b *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Bscip-go gomod github.com/golang/go/src go1.23.0 testing/B#) {
893 reg, err := NewRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRegistry().()
894 if err != nil {
895 b.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("NewRegistry() failed: %v", err)
896 }
897 for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.23.0 testing/B#N.; i++ {
898 reg.Copyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry#Copy().()
899 }
900 }
901
902 // Helper types useful for testing extensions of primitive types.
903 type nonConvertiblescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/nonConvertible# struct {
904 Fieldscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/nonConvertible#Field. string
905 }
906 type testBoolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testBool# bool
907 type testIntscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt# int
908 type testInt8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt8# int8
909 type testInt16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt16# int16
910 type testInt32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt32# int32
911 type testInt64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testInt64# int64
912 type testUintscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint# uint
913 type testUint8scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint8# uint8
914 type testUint16scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint16# uint16
915 type testUint32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint32# uint32
916 type testUint64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testUint64# uint64
917 type testFloat32scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat32# float32
918 type testFloat64scip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testFloat64# float64
919 type testStringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/testString# string
920
921 func newTestRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/newTestRegistry().(t *testingscip-go gomod github.com/golang/go/src go1.23.0 testing/.Tscip-go gomod github.com/golang/go/src go1.23.0 testing/T#, types ...protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#) *Registryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Registry# {
922 t.Helperscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Helper().()
923 reg, err := NewRegistryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewRegistry().(types...)
924 if err != nil {
925 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.0 testing/common#Fatalf().("NewRegistry(%v) failed: %v", types, err)
926 }
927 return reg
928 }