Commit 2a572df0 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

ignore trailing slashes

parent 351b5d0f
......@@ -9,6 +9,10 @@ import (
)
func stringToBytes(s string) ([]byte, error) {
// consume trailing slashes
s = strings.TrimRight(s, "/")
b := []byte{}
sp := strings.Split(s, "/")
......
......@@ -18,6 +18,7 @@ func TestEqual(t *testing.T) {
m1 := newMultiaddr(t, "/ip4/127.0.0.1/udp/1234")
m2 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
m3 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
m4 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234/")
if m1.Equal(m2) {
t.Error("should not be equal")
......@@ -38,6 +39,14 @@ func TestEqual(t *testing.T) {
if !m1.Equal(m1) {
t.Error("should be equal")
}
if !m2.Equal(m4) {
t.Error("should be equal")
}
if !m4.Equal(m3) {
t.Error("should be equal")
}
}
func TestStringToBytes(t *testing.T) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment