Explorar o código

goprotobuf: Fix test for text format number too large for int64.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://codereview.appspot.com/111460043
David Symonds %!s(int64=11) %!d(string=hai) anos
pai
achega
8bb628dd72
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  1. 2 0
      proto/text_parser.go
  2. 2 2
      proto/text_parser_test.go

+ 2 - 0
proto/text_parser.go

@@ -612,6 +612,7 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) *ParseError {
 			fv.SetInt(x)
 			return nil
 		}
+
 		if len(props.Enum) == 0 {
 			break
 		}
@@ -630,6 +631,7 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) *ParseError {
 			fv.SetInt(x)
 			return nil
 		}
+
 	case reflect.Ptr:
 		// A basic field (indirected through pointer), or a repeated message/group
 		p.back()

+ 2 - 2
proto/text_parser_test.go

@@ -156,8 +156,8 @@ var unMarshalTextTests = []UnmarshalTextTest{
 
 	// Number too large for int64
 	{
-		in:  "count: 123456789012345678901",
-		err: "line 1.7: invalid int32: 123456789012345678901",
+		in:  "count: 1 others { key: 123456789012345678901 }",
+		err: "line 1.23: invalid int64: 123456789012345678901",
 	},
 
 	// Number too large for int32