summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go')
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
index a793c8856..5c463722d 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go
@@ -18,15 +18,14 @@ import (
"bytes"
"testing"
- "github.com/golang/protobuf/proto"
-
- . "github.com/matttproud/golang_protobuf_extensions/testdata"
+ . "github.com/golang/protobuf/proto"
+ . "github.com/golang/protobuf/proto/testdata"
)
func TestWriteDelimited(t *testing.T) {
t.Parallel()
for _, test := range []struct {
- msg proto.Message
+ msg Message
buf []byte
n int
err error
@@ -43,7 +42,7 @@ func TestWriteDelimited(t *testing.T) {
},
{
msg: &Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
+ StringField: String(`This is my gigantic, unhappy string. It exceeds
the encoding size of a single byte varint. We are using it to fuzz test the
correctness of the header decoding mechanisms, which may prove problematic.
I expect it may. Let's hope you enjoy testing as much as we do.`),
@@ -83,7 +82,7 @@ func TestReadDelimited(t *testing.T) {
t.Parallel()
for _, test := range []struct {
buf []byte
- msg proto.Message
+ msg Message
n int
err error
}{
@@ -117,7 +116,7 @@ func TestReadDelimited(t *testing.T) {
106, 111, 121, 32, 116, 101, 115, 116, 105, 110, 103, 32, 97, 115, 32,
109, 117, 99, 104, 32, 97, 115, 32, 119, 101, 32, 100, 111, 46},
msg: &Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
+ StringField: String(`This is my gigantic, unhappy string. It exceeds
the encoding size of a single byte varint. We are using it to fuzz test the
correctness of the header decoding mechanisms, which may prove problematic.
I expect it may. Let's hope you enjoy testing as much as we do.`),
@@ -125,12 +124,12 @@ I expect it may. Let's hope you enjoy testing as much as we do.`),
n: 271,
},
} {
- msg := proto.Clone(test.msg)
+ msg := Clone(test.msg)
msg.Reset()
if n, err := ReadDelimited(bytes.NewBuffer(test.buf), msg); n != test.n || err != test.err {
t.Fatalf("ReadDelimited(%v, msg) = %v, %v; want %v, %v", test.buf, n, err, test.n, test.err)
}
- if !proto.Equal(msg, test.msg) {
+ if !Equal(msg, test.msg) {
t.Fatalf("ReadDelimited(%v, msg); msg = %v; want %v", test.buf, msg, test.msg)
}
}
@@ -138,12 +137,12 @@ I expect it may. Let's hope you enjoy testing as much as we do.`),
func TestEndToEndValid(t *testing.T) {
t.Parallel()
- for _, test := range [][]proto.Message{
+ for _, test := range [][]Message{
{&Empty{}},
{&GoEnum{Foo: FOO_FOO1.Enum()}, &Empty{}, &GoEnum{Foo: FOO_FOO1.Enum()}},
{&GoEnum{Foo: FOO_FOO1.Enum()}},
{&Strings{
- StringField: proto.String(`This is my gigantic, unhappy string. It exceeds
+ StringField: String(`This is my gigantic, unhappy string. It exceeds
the encoding size of a single byte varint. We are using it to fuzz test the
correctness of the header decoding mechanisms, which may prove problematic.
I expect it may. Let's hope you enjoy testing as much as we do.`),
@@ -162,12 +161,12 @@ I expect it may. Let's hope you enjoy testing as much as we do.`),
}
var read int
for i, msg := range test {
- out := proto.Clone(msg)
+ out := Clone(msg)
out.Reset()
n, _ := ReadDelimited(&buf, out)
// Decide to do EOF checking?
read += n
- if !proto.Equal(out, msg) {
+ if !Equal(out, msg) {
t.Fatalf("out = %v; want %v[%d] = %#v", out, test, i, msg)
}
}