[#607] network: Do not return error from Address.HostAddrString method

Panic if internal `manet.DialArgs` call returns error since this is
unexpected according to `AddressFromString` implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-16 14:08:07 +03:00 committed by Leonard Lyubich
parent 4c2d8d5ac9
commit 35f81729e4
6 changed files with 15 additions and 36 deletions

View file

@ -62,8 +62,7 @@ func TestAddress_HostAddrString(t *testing.T) {
for _, testcase := range testcases {
addr := Address{testcase.ma}
got, err := addr.HostAddrString()
require.NoError(t, err)
got := addr.HostAddrString()
require.Equal(t, testcase.exp, got)
}
@ -76,8 +75,7 @@ func TestAddress_HostAddrString(t *testing.T) {
for _, testcase := range testcases {
addr := Address{testcase}
_, err := addr.HostAddrString()
require.Error(t, err)
require.Panics(t, func() { addr.HostAddrString() })
}
})
}