goprotobuf: sync from Google internal version.
Interesting changes:
- String method on protocol buffer message types
that renders the message in compact text format.
- Extension text formatting.
R=r
CC=golang-dev
http://codereview.appspot.com/4643050
diff --git a/proto/text_test.go b/proto/text_test.go
index e31e21c..1427740 100644
--- a/proto/text_test.go
+++ b/proto/text_test.go
@@ -39,7 +39,7 @@
)
func newTestMessage() *MyMessage {
- return &MyMessage{
+ msg := &MyMessage{
Count: Int32(42),
Name: String("Dave"),
Quote: String(`"I didn't want to go."`),
@@ -67,6 +67,13 @@
GroupField: Int32(8),
},
}
+ ext := &Ext{
+ Data: String("Big gobs for big rats"),
+ }
+ if err := SetExtension(msg, E_Ext_More, ext); err != nil {
+ panic(err)
+ }
+ return msg
}
const text = `count: 42
@@ -95,6 +102,9 @@
SomeGroup {
group_field: 8
}
+[test_proto.more]: <
+ data: "Big gobs for big rats"
+>
`
func TestMarshalTextFull(t *testing.T) {
@@ -107,7 +117,7 @@
}
func compact(src string) string {
- // ,s/[ \n]+/ /g; s/ $//;
+ // s/[ \n]+/ /g; s/ $//;
dst := make([]byte, len(src))
space := false
j := 0