Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
2a572df0
Commit
2a572df0
authored
Oct 10, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore trailing slashes
parent
351b5d0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
codec.go
codec.go
+4
-0
multiaddr_test.go
multiaddr_test.go
+9
-0
No files found.
codec.go
View file @
2a572df0
...
...
@@ -9,6 +9,10 @@ import (
)
func
stringToBytes
(
s
string
)
([]
byte
,
error
)
{
// consume trailing slashes
s
=
strings
.
TrimRight
(
s
,
"/"
)
b
:=
[]
byte
{}
sp
:=
strings
.
Split
(
s
,
"/"
)
...
...
multiaddr_test.go
View file @
2a572df0
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment