goprotobuf: Support encoding.TextMarshaler and encoding.TextUnmarshaler.
LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/65740044
diff --git a/proto/text_parser_test.go b/proto/text_parser_test.go
index 5949065..e447ffa 100644
--- a/proto/text_parser_test.go
+++ b/proto/text_parser_test.go
@@ -413,6 +413,16 @@
}
}
+func TestUnmarshalTextCustomMessage(t *testing.T) {
+ msg := &textMessage{}
+ if err := UnmarshalText("custom", msg); err != nil {
+ t.Errorf("Unexpected error from custom unmarshal: %v", err)
+ }
+ if UnmarshalText("not custom", msg) == nil {
+ t.Errorf("Didn't get expected error from custom unmarshal")
+ }
+}
+
// Regression test; this caused a panic.
func TestRepeatedEnum(t *testing.T) {
pb := new(RepeatedEnum)