goprotobuf: Fix SetDefaults to recur into repeated submessages.
R=r
CC=golang-dev
https://codereview.appspot.com/11255043
diff --git a/proto/all_test.go b/proto/all_test.go
index 6478c57..9d51158 100644
--- a/proto/all_test.go
+++ b/proto/all_test.go
@@ -1341,6 +1341,21 @@
}
}
+func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
+ m := &MyMessage{
+ RepInner: []*InnerMessage{{}},
+ }
+ expected := &MyMessage{
+ RepInner: []*InnerMessage{{
+ Port: Int32(4000),
+ }},
+ }
+ SetDefaults(m)
+ if !Equal(m, expected) {
+ t.Errorf("\n got %v\nwant %v", m, expected)
+ }
+}
+
func TestMaximumTagNumber(t *testing.T) {
m := &MaxTag{
LastField: String("natural goat essence"),