@@ -979,15 +979,15 @@ func TestUnmarshalNestedStruct(t *testing.T) {
979
979
}
980
980
981
981
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 )
983
983
}
984
984
985
985
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 )
987
987
}
988
988
989
989
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 )
991
991
}
992
992
}
993
993
@@ -1040,14 +1040,16 @@ func TestUnmarshalNestedStructSlice(t *testing.T) {
1040
1040
}
1041
1041
1042
1042
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 )
1044
1044
}
1045
1045
1046
1046
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 ))
1048
1049
}
1049
1050
1050
1051
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 )
1052
1054
}
1053
1055
}
0 commit comments