diff --git a/conformance/BUILD.bazel b/conformance/BUILD.bazel index 52deaf52..85b6aa13 100644 --- a/conformance/BUILD.bazel +++ b/conformance/BUILD.bazel @@ -7,9 +7,11 @@ package( _ALL_TESTS = [ "@com_google_cel_spec//tests/simple:testdata/basic.textproto", + "@com_google_cel_spec//tests/simple:testdata/bindings_ext.textproto", "@com_google_cel_spec//tests/simple:testdata/comparisons.textproto", "@com_google_cel_spec//tests/simple:testdata/conversions.textproto", "@com_google_cel_spec//tests/simple:testdata/dynamic.textproto", + "@com_google_cel_spec//tests/simple:testdata/encoders_ext.textproto", "@com_google_cel_spec//tests/simple:testdata/enums.textproto", "@com_google_cel_spec//tests/simple:testdata/fields.textproto", "@com_google_cel_spec//tests/simple:testdata/fp_math.textproto", @@ -23,6 +25,7 @@ _ALL_TESTS = [ "@com_google_cel_spec//tests/simple:testdata/parse.textproto", "@com_google_cel_spec//tests/simple:testdata/plumbing.textproto", "@com_google_cel_spec//tests/simple:testdata/proto2.textproto", + "@com_google_cel_spec//tests/simple:testdata/proto2_ext.textproto", "@com_google_cel_spec//tests/simple:testdata/proto3.textproto", "@com_google_cel_spec//tests/simple:testdata/string.textproto", "@com_google_cel_spec//tests/simple:testdata/string_ext.textproto", @@ -44,6 +47,9 @@ _TESTS_TO_SKIP = [ "macros/map/map_extract_keys", "timestamps/duration_converters/get_milliseconds", + # Failing conformance test for unknown reasons + "encoders_ext/decode/hello_without_padding", + # Future enhancments. "enums/strong_proto2", "enums/strong_proto3", diff --git a/conformance/conformance_test.go b/conformance/conformance_test.go index bc343adf..0787c8a7 100644 --- a/conformance/conformance_test.go +++ b/conformance/conformance_test.go @@ -1,4 +1,4 @@ -package conformance +package conformance_test import ( "errors" @@ -9,8 +9,6 @@ import ( "strings" "testing" - "cel.dev/expr/proto/test/v1/testpb" - "github.com/bazelbuild/rules_go/go/runfiles" "github.com/google/cel-go/cel" @@ -25,6 +23,7 @@ import ( test2pb "cel.dev/expr/proto/test/v1/proto2/test_all_types" test3pb "cel.dev/expr/proto/test/v1/proto3/test_all_types" + testpb "cel.dev/expr/proto/test/v1/testpb" exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) @@ -79,18 +78,26 @@ func init() { flag.Var(&tests, "tests", "Paths to run, separate by a comma.") flag.Var(&skipTests, "skip_tests", "Tests to skip, separate by a comma.") - var err error - envWithMacros, err = cel.NewCustomEnv(cel.StdLib(), cel.OptionalTypes(), + stdOpts := []cel.EnvOption{ + cel.StdLib(), + cel.ClearMacros(), + cel.OptionalTypes(), cel.EagerlyValidateDeclarations(true), cel.EnableErrorOnBadPresenceTest(true), - cel.Types(&test2pb.TestAllTypes{}, &test3pb.TestAllTypes{}), cel.Macros(cel.StandardMacros...), ext.Bindings(), ext.Encoders(), ext.Math(), ext.Protos(), ext.Strings()) + cel.Types(&test2pb.TestAllTypes{}, &test2pb.Proto2ExtensionScopedMessage{}, &test3pb.TestAllTypes{}), + ext.Bindings(), + ext.Encoders(), + ext.Math(), + ext.Protos(), + ext.Strings(), + } + + var err error + envNoMacros, err = cel.NewCustomEnv(stdOpts...) if err != nil { log.Fatalf("cel.NewCustomEnv() = %v", err) } - envNoMacros, err = cel.NewCustomEnv(cel.StdLib(), cel.OptionalTypes(), - cel.EagerlyValidateDeclarations(true), - cel.EnableErrorOnBadPresenceTest(true), - cel.Types(&test2pb.TestAllTypes{}, &test3pb.TestAllTypes{}), ext.Bindings(), ext.Encoders(), ext.Math(), ext.Protos(), ext.Strings(), cel.ClearMacros()) + envWithMacros, err = envNoMacros.Extend(cel.Macros(cel.StandardMacros...)) if err != nil { log.Fatalf("cel.NewCustomEnv() = %v", err) }