diff --git a/yaml_test.go b/yaml_test.go index e8e19cc..941fde2 100644 --- a/yaml_test.go +++ b/yaml_test.go @@ -495,6 +495,30 @@ func TestUnmarshal(t *testing.T) { }, }, + // BUG: type info gets lost (#58) + "decode embeded struct and cast integer to string": { + encoded: []byte("a: 11\nb: testB"), + decodeInto: new(UnmarshalEmbedStruct), + decoded: UnmarshalEmbedStruct{ + UnmarshalStruct: UnmarshalStruct{ + A: "11", + }, + B: "testB", + }, + err: fatalErrorsType, + }, + "decode embeded structpointer and cast integer to string": { + encoded: []byte("a: 11\nb: testB"), + decodeInto: new(UnmarshalEmbedStructPointer), + decoded: UnmarshalEmbedStructPointer{ + UnmarshalStruct: &UnmarshalStruct{ + A: "11", + }, + B: "testB", + }, + err: fatalErrorsType, + }, + // decoding into incompatible type "decode into stringmap with incompatible type": { encoded: []byte("a:\n a:\n a: 3"),