Skip to content

Commit

Permalink
Rename conformance proto import for ease of syncing (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristonianJones authored Nov 18, 2024
1 parent 24ec244 commit 72e0977
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/testing/protocmp"

celpb "cel.dev/expr"
valuepb "cel.dev/expr"
test2pb "cel.dev/expr/conformance/proto2"
test3pb "cel.dev/expr/conformance/proto3"
testpb "cel.dev/expr/conformance/test"
Expand Down Expand Up @@ -125,11 +125,11 @@ func shouldSkipTest(s string) bool {
return false
}

func refValueToExprValue(res ref.Val) (*celpb.ExprValue, error) {
func refValueToExprValue(res ref.Val) (*valuepb.ExprValue, error) {
if types.IsUnknown(res) {
return &celpb.ExprValue{
Kind: &celpb.ExprValue_Unknown{
Unknown: &celpb.UnknownSet{
return &valuepb.ExprValue{
Kind: &valuepb.ExprValue_Unknown{
Unknown: &valuepb.UnknownSet{
Exprs: res.Value().([]int64),
},
}}, nil
Expand All @@ -138,15 +138,15 @@ func refValueToExprValue(res ref.Val) (*celpb.ExprValue, error) {
if err != nil {
return nil, err
}
return &celpb.ExprValue{
Kind: &celpb.ExprValue_Value{Value: v}}, nil
return &valuepb.ExprValue{
Kind: &valuepb.ExprValue_Value{Value: v}}, nil
}

func exprValueToRefValue(adapter types.Adapter, ev *celpb.ExprValue) (ref.Val, error) {
func exprValueToRefValue(adapter types.Adapter, ev *valuepb.ExprValue) (ref.Val, error) {
switch ev.Kind.(type) {
case *celpb.ExprValue_Value:
case *valuepb.ExprValue_Value:
return cel.ProtoAsValue(adapter, ev.GetValue())
case *celpb.ExprValue_Error:
case *valuepb.ExprValue_Error:
// An error ExprValue is a repeated set of statuspb.Status
// messages, with no convention for the status details.
// To convert this to a types.Err, we need to convert
Expand All @@ -155,7 +155,7 @@ func exprValueToRefValue(adapter types.Adapter, ev *celpb.ExprValue) (ref.Val, e
// round-trip arbitrary ExprValue messages.
// TODO(jimlarson) make a convention for this.
return types.NewErr("XXX add details later"), nil
case *celpb.ExprValue_Unknown:
case *valuepb.ExprValue_Unknown:
var unk *types.Unknown
for _, id := range ev.GetUnknown().GetExprs() {
if unk == nil {
Expand Down Expand Up @@ -227,7 +227,7 @@ func conformanceTest(t *testing.T, name string, pb *testpb.SimpleTest) {
if err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(&celpb.ExprValue{Kind: &celpb.ExprValue_Value{Value: m.Value}}, val, protocmp.Transform(), protocmp.SortRepeatedFields(&celpb.MapValue{}, "entries")); diff != "" {
if diff := cmp.Diff(&valuepb.ExprValue{Kind: &valuepb.ExprValue_Value{Value: m.Value}}, val, protocmp.Transform(), protocmp.SortRepeatedFields(&valuepb.MapValue{}, "entries")); diff != "" {
t.Errorf("program.Eval() diff (-want +got):\n%s", diff)
}
case *testpb.SimpleTest_EvalError:
Expand Down Expand Up @@ -267,8 +267,8 @@ func TestConformance(t *testing.T) {
name := fmt.Sprintf("%s/%s/%s", file.GetName(), section.GetName(), test.GetName())
if test.GetResultMatcher() == nil {
test.ResultMatcher = &testpb.SimpleTest_Value{
Value: &celpb.Value{
Kind: &celpb.Value_BoolValue{
Value: &valuepb.Value{
Kind: &valuepb.Value_BoolValue{
BoolValue: true,
},
},
Expand Down

0 comments on commit 72e0977

Please sign in to comment.