@@ -73,8 +73,9 @@ private void runTest() throws Exception {
7373 CelAbstractSyntaxTree ast =
7474 prepareTest (
7575 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 ()));
7879 if (ast != null ) {
7980 testOutput ()
8081 .println (
@@ -239,6 +240,45 @@ public void messageFieldSelect() throws Exception {
239240 runTest ();
240241 }
241242
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+
242282 @ Test
243283 public void messageCreationError () throws Exception {
244284 declareVariable ("x" , SimpleType .INT );
@@ -851,17 +891,16 @@ public void twoVarComprehensions_incorrectIterVars() throws Exception {
851891 public void twoVarComprehensions_duplicateIterVars () throws Exception {
852892 CelType messageType = StructTypeReference .create ("cel.expr.conformance.proto3.TestAllTypes" );
853893 declareVariable ("x" , messageType );
854- source =
855- "x.repeated_int64.exists(i, i, i < v)" ;
894+ source = "x.repeated_int64.exists(i, i, i < v)" ;
856895 runTest ();
857896 }
858-
897+
859898 @ Test
860899 public void twoVarComprehensions_incorrectNumberOfArgs () throws Exception {
861900 CelType messageType = StructTypeReference .create ("cel.expr.conformance.proto3.TestAllTypes" );
862901 declareVariable ("x" , messageType );
863902 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)"
865904 + "&& x.map_string_string.transformList(i, i < v) "
866905 + "&& [1, 2, 3].transformList(i, v, i > 0 && x < 3, (i * v) + v) == [4]" ;
867906 runTest ();
0 commit comments