File tree Expand file tree Collapse file tree 4 files changed +72
-68
lines changed
Expand file tree Collapse file tree 4 files changed +72
-68
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,20 @@ Assume you have the following `.proto` file defining `Foo` and `Qux` messages:
4141``` protobuf
4242syntax = "proto3";
4343
44- package test;
44+ package api.v1;
45+ option go_package = "github.com/afritzler/protoequal/test/api/v1";
4546
47+ // The Foo message with Bar, Baz fields and a nested message Qux.
4648message Foo {
47- string bar = 1;
48- string baz = 2;
49- Qux qux = 3;
49+ string bar = 1; // Bar field
50+ string baz = 2; // Baz field
51+ Qux qux = 3; // Qux is a nested message
5052}
5153
54+ // The Qux message with Driver and Handle fields.
5255message Qux {
53- string driver = 1;
54- string handle = 2;
56+ string driver = 1; // Driver field
57+ string handle = 2; // Handle field
5558}
5659```
5760
@@ -69,7 +72,7 @@ import (
6972
7073 " google.golang.org/protobuf/proto"
7174 . " github.com/afritzler/protoequal"
72- " github.com/afritzler/protoequal/test"
75+ " github.com/afritzler/protoequal/test/api/v1 "
7376 " github.com/onsi/gomega"
7477)
7578
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ package matchers_test
33import (
44 "testing"
55
6+ v1 "github.com/afritzler/protoequal/test/api/v1"
67 "github.com/onsi/gomega"
78 "google.golang.org/protobuf/proto"
89
910 matchers "github.com/afritzler/protoequal"
10- "github.com/afritzler/protoequal/test"
1111)
1212
1313func TestProtoEqualMatcher (t * testing.T ) {
@@ -22,18 +22,18 @@ func TestProtoEqualMatcher(t *testing.T) {
2222 }{
2323 {
2424 name : "Should match identical messages" ,
25- actual : & test .Foo {
25+ actual : & v1 .Foo {
2626 Bar : "test-bar" ,
2727 Baz : "test-baz" ,
28- Qux : & test .Qux {
28+ Qux : & v1 .Qux {
2929 Driver : "foo-driver" ,
3030 Handle : "foo-handle" ,
3131 },
3232 },
33- expected : & test .Foo {
33+ expected : & v1 .Foo {
3434 Bar : "test-bar" ,
3535 Baz : "test-baz" ,
36- Qux : & test .Qux {
36+ Qux : & v1 .Qux {
3737 Driver : "foo-driver" ,
3838 Handle : "foo-handle" ,
3939 },
@@ -42,18 +42,18 @@ func TestProtoEqualMatcher(t *testing.T) {
4242 },
4343 {
4444 name : "Should not match different messages" ,
45- actual : & test .Foo {
45+ actual : & v1 .Foo {
4646 Bar : "test-bar" ,
4747 Baz : "test-baz" ,
48- Qux : & test .Qux {
48+ Qux : & v1 .Qux {
4949 Driver : "foo-driver" ,
5050 Handle : "foo-handle" ,
5151 },
5252 },
53- expected : & test .Foo {
53+ expected : & v1 .Foo {
5454 Bar : "different-bar" ,
5555 Baz : "test-baz" ,
56- Qux : & test .Qux {
56+ Qux : & v1 .Qux {
5757 Driver : "foo-driver" ,
5858 Handle : "foo-handle" ,
5959 },
@@ -62,18 +62,18 @@ func TestProtoEqualMatcher(t *testing.T) {
6262 },
6363 {
6464 name : "Should not match messages with different nested fields" ,
65- actual : & test .Foo {
65+ actual : & v1 .Foo {
6666 Bar : "test-bar" ,
6767 Baz : "test-baz" ,
68- Qux : & test .Qux {
68+ Qux : & v1 .Qux {
6969 Driver : "foo-driver" ,
7070 Handle : "foo-handle" ,
7171 },
7272 },
73- expected : & test .Foo {
73+ expected : & v1 .Foo {
7474 Bar : "test-bar" ,
7575 Baz : "test-baz" ,
76- Qux : & test .Qux {
76+ Qux : & v1 .Qux {
7777 Driver : "different-driver" ,
7878 Handle : "foo-handle" ,
7979 },
Original file line number Diff line number Diff line change 11syntax = "proto3" ;
22
3- package test ;
4- option go_package = "github.com/afritzler/protoequal/test" ;
3+ package api.v1 ;
4+ option go_package = "github.com/afritzler/protoequal/test/api/v1 " ;
55
66// The Foo message with Bar, Baz fields and a nested message Qux.
77message Foo {
You can’t perform that action at this time.
0 commit comments