Skip to content

Commit 1b2246d

Browse files
committed
test: test unix addrs
1 parent a5c136c commit 1b2246d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

convert_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ func TestFromIP4(t *testing.T) {
6464
})
6565
}
6666

67+
func TestFromUnix(t *testing.T) {
68+
testConvert(t, "/unix/c:/foo/bar", func() (ma.Multiaddr, error) {
69+
return FromNetAddr(&net.UnixAddr{Name: "/c:/foo/bar", Net: "unix"})
70+
})
71+
testConvert(t, "/unix/foo/bar", func() (ma.Multiaddr, error) {
72+
return FromNetAddr(&net.UnixAddr{Name: "/foo/bar", Net: "unix"})
73+
})
74+
}
75+
76+
func TestToUnix(t *testing.T) {
77+
testToNetAddr(t, "/unix/c:/foo/bar", "unix", "/c:/foo/bar")
78+
testToNetAddr(t, "/unix/foo/bar", "unix", "/foo/bar")
79+
}
80+
6781
func TestFromIP6(t *testing.T) {
6882
testConvert(t, "/ip6/2001:4860:0:2001::68", func() (ma.Multiaddr, error) {
6983
return FromNetAddr(&net.IPAddr{IP: net.ParseIP("2001:4860:0:2001::68")})

0 commit comments

Comments
 (0)