From: Matt Joiner Date: Tue, 23 Feb 2016 12:53:39 +0000 (+1100) Subject: metainfo: Check for error unmarshalling bad nodes contents from a metainfo X-Git-Tag: v1.0.0~847 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a04fb2ce268f9e998e256e17b4e203a1ad16b510;p=btrtrc.git metainfo: Check for error unmarshalling bad nodes contents from a metainfo --- diff --git a/metainfo/nodes_test.go b/metainfo/nodes_test.go index 585120b7..ca769b16 100644 --- a/metainfo/nodes_test.go +++ b/metainfo/nodes_test.go @@ -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) +}