@@ -584,36 +584,36 @@ func TestMarshalJSONPBMarshaler(t *testing.T) {
584
584
msg := dynamicMessage {RawJson : rawJson }
585
585
str , err := new (Marshaler ).MarshalToString (& msg )
586
586
if err != nil {
587
- t .Errorf ("an unexpected error occurred when marshalling JSONPBMarshaler: %v" , err )
587
+ t .Errorf ("an unexpected error occurred when marshaling JSONPBMarshaler: %v" , err )
588
588
}
589
589
if str != rawJson {
590
- t .Errorf ("marshalling JSON produced incorrect output: got %s, wanted %s" , str , rawJson )
590
+ t .Errorf ("marshaling JSON produced incorrect output: got %s, wanted %s" , str , rawJson )
591
591
}
592
592
}
593
593
594
594
func TestMarshalAnyJSONPBMarshaler (t * testing.T ) {
595
595
msg := dynamicMessage {RawJson : `{ "foo": "bar", "baz": [0, 1, 2, 3] }` }
596
596
a , err := ptypes .MarshalAny (& msg )
597
597
if err != nil {
598
- t .Errorf ("an unexpected error occurred when marshalling to Any: %v" , err )
598
+ t .Errorf ("an unexpected error occurred when marshaling to Any: %v" , err )
599
599
}
600
600
str , err := new (Marshaler ).MarshalToString (a )
601
601
if err != nil {
602
- t .Errorf ("an unexpected error occurred when marshalling Any to JSON: %v" , err )
602
+ t .Errorf ("an unexpected error occurred when marshaling Any to JSON: %v" , err )
603
603
}
604
604
// after custom marshaling, it's round-tripped through JSON decoding/encoding already,
605
605
// so the keys are sorted, whitespace is compacted, and "@type" key has been added
606
606
expected := `{"@type":"type.googleapis.com/` + dynamicMessageName + `","baz":[0,1,2,3],"foo":"bar"}`
607
607
if str != expected {
608
- t .Errorf ("marshalling JSON produced incorrect output: got %s, wanted %s" , str , expected )
608
+ t .Errorf ("marshaling JSON produced incorrect output: got %s, wanted %s" , str , expected )
609
609
}
610
610
611
611
// Do it again, but this time with indentation:
612
612
613
613
marshaler := Marshaler {Indent : " " }
614
614
str , err = marshaler .MarshalToString (a )
615
615
if err != nil {
616
- t .Errorf ("an unexpected error occurred when marshalling Any to JSON: %v" , err )
616
+ t .Errorf ("an unexpected error occurred when marshaling Any to JSON: %v" , err )
617
617
}
618
618
// same as expected above, but pretty-printed w/ indentation
619
619
expected = `{
@@ -627,7 +627,7 @@ func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
627
627
"foo": "bar"
628
628
}`
629
629
if str != expected {
630
- t .Errorf ("marshalling JSON produced incorrect output: got %s, wanted %s" , str , expected )
630
+ t .Errorf ("marshaling JSON produced incorrect output: got %s, wanted %s" , str , expected )
631
631
}
632
632
}
633
633
@@ -636,11 +636,11 @@ func TestMarshalWithCustomValidation(t *testing.T) {
636
636
637
637
js , err := new (Marshaler ).MarshalToString (& msg )
638
638
if err != nil {
639
- t .Errorf ("an unexpected error occurred when marshalling to json: %v" , err )
639
+ t .Errorf ("an unexpected error occurred when marshaling to json: %v" , err )
640
640
}
641
641
err = Unmarshal (strings .NewReader (js ), & msg )
642
642
if err != nil {
643
- t .Errorf ("an unexpected error occurred when unmarshalling from json: %v" , err )
643
+ t .Errorf ("an unexpected error occurred when unmarshaling from json: %v" , err )
644
644
}
645
645
}
646
646
@@ -883,7 +883,7 @@ func TestUnmarshaling(t *testing.T) {
883
883
884
884
err := tt .unmarshaler .Unmarshal (strings .NewReader (tt .json ), p )
885
885
if err != nil {
886
- t .Errorf ("unmarshalling %s: %v" , tt .desc , err )
886
+ t .Errorf ("unmarshaling %s: %v" , tt .desc , err )
887
887
continue
888
888
}
889
889
@@ -1017,7 +1017,7 @@ func TestAnyWithCustomResolver(t *testing.T) {
1017
1017
}
1018
1018
wanted := `{"@type":"https://foobar.com/some.random.MessageKind","oBool":true,"oInt64":"1020304","oString":"foobar","oBytes":"AQIDBA=="}`
1019
1019
if js != wanted {
1020
- t .Errorf ("marshalling JSON produced incorrect output: got %s, wanted %s" , js , wanted )
1020
+ t .Errorf ("marshaling JSON produced incorrect output: got %s, wanted %s" , js , wanted )
1021
1021
}
1022
1022
1023
1023
u := Unmarshaler {AnyResolver : resolver }
@@ -1032,7 +1032,7 @@ func TestAnyWithCustomResolver(t *testing.T) {
1032
1032
t .Errorf ("custom resolver was invoked with wrong URL: got %q, wanted %q" , resolvedTypeUrls [1 ], "https://foobar.com/some.random.MessageKind" )
1033
1033
}
1034
1034
if ! proto .Equal (any , roundTrip ) {
1035
- t .Errorf ("message contents not set correctly after unmarshalling JSON: got %s, wanted %s" , roundTrip , any )
1035
+ t .Errorf ("message contents not set correctly after unmarshaling JSON: got %s, wanted %s" , roundTrip , any )
1036
1036
}
1037
1037
}
1038
1038
@@ -1043,7 +1043,7 @@ func TestUnmarshalJSONPBUnmarshaler(t *testing.T) {
1043
1043
t .Errorf ("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v" , err )
1044
1044
}
1045
1045
if msg .RawJson != rawJson {
1046
- t .Errorf ("message contents not set correctly after unmarshalling JSON: got %s, wanted %s" , msg .RawJson , rawJson )
1046
+ t .Errorf ("message contents not set correctly after unmarshaling JSON: got %s, wanted %s" , msg .RawJson , rawJson )
1047
1047
}
1048
1048
}
1049
1049
@@ -1077,7 +1077,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {
1077
1077
}
1078
1078
1079
1079
if ! proto .Equal (& got , & want ) {
1080
- t .Errorf ("message contents not set correctly after unmarshalling JSON: got %v, wanted %v" , got , want )
1080
+ t .Errorf ("message contents not set correctly after unmarshaling JSON: got %v, wanted %v" , got , want )
1081
1081
}
1082
1082
}
1083
1083
0 commit comments