@@ -73,8 +73,9 @@ private void runTest() throws Exception {
73
73
CelAbstractSyntaxTree ast =
74
74
prepareTest (
75
75
Arrays .asList (
76
- TestAllTypes .getDescriptor (),
77
- dev .cel .expr .conformance .proto2 .TestAllTypes .getDescriptor ()));
76
+ StandaloneGlobalEnum .getDescriptor ().getFile (),
77
+ TestAllTypes .getDescriptor ().getFile (),
78
+ dev .cel .expr .conformance .proto2 .TestAllTypes .getDescriptor ().getFile ()));
78
79
if (ast != null ) {
79
80
testOutput ()
80
81
.println (
@@ -239,6 +240,45 @@ public void messageFieldSelect() throws Exception {
239
240
runTest ();
240
241
}
241
242
243
+ @ Test
244
+ public void containers () throws Exception {
245
+ container =
246
+ CelContainer .newBuilder ()
247
+ .setName ("dev.cel.testing.testdata.proto3.StandaloneGlobalEnum" )
248
+ .addAlias ("p3_alias" , "cel.expr.conformance.proto3" )
249
+ .addAlias ("foo_bar_alias" , "foo.bar" )
250
+ .addAlias ("foo_bar_baz_alias" , "foo.bar.baz" )
251
+ .addAbbreviations ("cel.expr.conformance.proto2" , "cel.expr.conformance.proto3" )
252
+ .build ();
253
+ source = "p3_alias.TestAllTypes{}" ;
254
+ runTest ();
255
+
256
+ source = "proto2.TestAllTypes{}" ;
257
+ runTest ();
258
+
259
+ source = "proto3.TestAllTypes{}" ;
260
+ runTest ();
261
+
262
+ source = "SGAR" ; // From StandaloneGlobalEnum
263
+ runTest ();
264
+
265
+ declareVariable ("foo.bar" , SimpleType .STRING );
266
+ declareFunction (
267
+ "baz" ,
268
+ memberOverload (
269
+ "foo_bar_baz_overload" , ImmutableList .of (SimpleType .STRING ), SimpleType .DYN ));
270
+ // Member call of "baz()" on "foo.bar" identifier
271
+ source = "foo_bar_alias.baz()" ;
272
+ runTest ();
273
+
274
+ declareFunction (
275
+ "foo.bar.baz.qux" ,
276
+ globalOverload ("foo_bar_baz_qux_overload" , ImmutableList .of (), SimpleType .DYN ));
277
+ // Global call of "foo.bar.baz.qux" as a fully qualified name
278
+ source = "foo_bar_baz_alias.qux()" ;
279
+ runTest ();
280
+ }
281
+
242
282
@ Test
243
283
public void messageCreationError () throws Exception {
244
284
declareVariable ("x" , SimpleType .INT );
@@ -851,17 +891,16 @@ public void twoVarComprehensions_incorrectIterVars() throws Exception {
851
891
public void twoVarComprehensions_duplicateIterVars () throws Exception {
852
892
CelType messageType = StructTypeReference .create ("cel.expr.conformance.proto3.TestAllTypes" );
853
893
declareVariable ("x" , messageType );
854
- source =
855
- "x.repeated_int64.exists(i, i, i < v)" ;
894
+ source = "x.repeated_int64.exists(i, i, i < v)" ;
856
895
runTest ();
857
896
}
858
-
897
+
859
898
@ Test
860
899
public void twoVarComprehensions_incorrectNumberOfArgs () throws Exception {
861
900
CelType messageType = StructTypeReference .create ("cel.expr.conformance.proto3.TestAllTypes" );
862
901
declareVariable ("x" , messageType );
863
902
source =
864
- "[1, 2, 3, 4].exists_one(i, v, i < v, v)"
903
+ "[1, 2, 3, 4].exists_one(i, v, i < v, v)"
865
904
+ "&& x.map_string_string.transformList(i, i < v) "
866
905
+ "&& [1, 2, 3].transformList(i, v, i > 0 && x < 3, (i * v) + v) == [4]" ;
867
906
runTest ();
0 commit comments