@@ -979,15 +979,15 @@ func TestUnmarshalNestedStruct(t *testing.T) {
979979 }
980980
981981 if out .Boss .Firstname != "Hubert" {
982- t .Fatalf ("Nested struct was not unmarshalled" )
982+ t .Fatalf ("expected `Hubert` at out.Boss.Firstname, but got `%s`" , out . Boss . Firstname )
983983 }
984984
985985 if out .Boss .Age != 176 {
986- t .Fatalf ("Nested struct was not unmarshalled" )
986+ t .Fatalf ("expected `176` at out.Boss.Age, but got `%d`" , out . Boss . Age )
987987 }
988988
989989 if out .Boss .HiredAt .IsZero () {
990- t .Fatalf ("Nested struct was not unmarshalled" )
990+ t .Fatalf ("expected out.Boss.HiredAt to be zero, but got `%d`" , out . Boss . HiredAt )
991991 }
992992}
993993
@@ -1040,14 +1040,16 @@ func TestUnmarshalNestedStructSlice(t *testing.T) {
10401040 }
10411041
10421042 if out .Teams [0 ].Name != "Delivery Crew" {
1043- t .Fatalf ("Nested struct Team was not unmarshalled" )
1043+ t .Fatalf ("Nested struct not unmarshalled: Expected `Delivery Crew` but got `%s`" , out . Teams [ 0 ]. Name )
10441044 }
10451045
10461046 if len (out .Teams [0 ].Members ) != 2 {
1047- t .Fatalf ("Nested struct Members were not unmarshalled" )
1047+ t .Fatalf ("Nested struct not unmarshalled: Expected to have `2` Members but got `%d`" ,
1048+ len (out .Teams [0 ].Members ))
10481049 }
10491050
10501051 if out .Teams [0 ].Members [0 ].Firstname != "Philip J." {
1051- t .Fatalf ("Nested struct member was not unmarshalled" )
1052+ t .Fatalf ("Nested struct not unmarshalled: Expected `Philip J.` but got `%s`" ,
1053+ out .Teams [0 ].Members [0 ].Firstname )
10521054 }
10531055}
0 commit comments