From 1b2246d7bef87a082eec5f4e8b92cf394e694688 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 12 Sep 2019 14:14:50 -0700 Subject: [PATCH] test: test unix addrs --- convert_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/convert_test.go b/convert_test.go index 33250a0..0e5548d 100644 --- a/convert_test.go +++ b/convert_test.go @@ -64,6 +64,20 @@ func TestFromIP4(t *testing.T) { }) } +func TestFromUnix(t *testing.T) { + testConvert(t, "/unix/c:/foo/bar", func() (ma.Multiaddr, error) { + return FromNetAddr(&net.UnixAddr{Name: "/c:/foo/bar", Net: "unix"}) + }) + testConvert(t, "/unix/foo/bar", func() (ma.Multiaddr, error) { + return FromNetAddr(&net.UnixAddr{Name: "/foo/bar", Net: "unix"}) + }) +} + +func TestToUnix(t *testing.T) { + testToNetAddr(t, "/unix/c:/foo/bar", "unix", "/c:/foo/bar") + testToNetAddr(t, "/unix/foo/bar", "unix", "/foo/bar") +} + func TestFromIP6(t *testing.T) { testConvert(t, "/ip6/2001:4860:0:2001::68", func() (ma.Multiaddr, error) { return FromNetAddr(&net.IPAddr{IP: net.ParseIP("2001:4860:0:2001::68")})