metainfo: Check for error unmarshalling bad nodes contents from a metainfo

This commit is contained in:
Matt Joiner 2016-02-23 23:53:39 +11:00
parent 621ec7bac4
commit a04fb2ce26
1 changed files with 7 additions and 0 deletions

View File

@ -53,3 +53,10 @@ func TestMarshalMetainfoNodes(t *testing.T) {
Nodes: []Node{"1.2.3.4:5555", "not a hostport"},
})
}
func TestUnmarshalBadMetainfoNodes(t *testing.T) {
var mi MetaInfo
// Should barf on the integer in the nodes list.
err := bencode.Unmarshal([]byte("d5:nodesl1:ai42eee"), &mi)
require.Error(t, err)
}