Skip to content

Commit

Permalink
add test for issue nr.58
Browse files Browse the repository at this point in the history
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Oct 29, 2021
1 parent 5f9c00c commit ad85ea1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit ad85ea1

Please sign in to comment.