Skip to content

Commit 020c4d1

Browse files
committed
test: empty multiaddr
1 parent e395136 commit 020c4d1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

multiaddr_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func TestConstructFails(t *testing.T) {
7474
"/unix",
7575
"/ip4/1.2.3.4/tcp/80/unix",
7676
"/ip4/127.0.0.1/tcp/9090/http/p2p-webcrt-direct",
77+
"/",
78+
"",
7779
}
7880

7981
for _, a := range cases {
@@ -83,6 +85,13 @@ func TestConstructFails(t *testing.T) {
8385
}
8486
}
8587

88+
func TestEmptyMultiaddr(t *testing.T) {
89+
_, err := NewMultiaddrBytes([]byte{})
90+
if err == nil {
91+
t.Fatal("should have failed to parse empty multiaddr")
92+
}
93+
}
94+
8695
func TestConstructSucceeds(t *testing.T) {
8796
cases := []string{
8897
"/ip4/1.2.3.4",

0 commit comments

Comments
 (0)