OSDN Git Service
(root)
/
bytom
/
vapor.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
new repo
[bytom/vapor.git]
/
vendor
/
github.com
/
tendermint
/
tmlibs
/
common
/
net_test.go
1
package common
2
3
import (
4
"testing"
5
6
"github.com/stretchr/testify/assert"
7
)
8
9
func TestProtocolAndAddress(t *testing.T) {
10
11
cases := []struct {
12
fullAddr string
13
proto string
14
addr string
15
}{
16
{
17
"tcp://mydomain:80",
18
"tcp",
19
"mydomain:80",
20
},
21
{
22
"mydomain:80",
23
"tcp",
24
"mydomain:80",
25
},
26
{
27
"unix://mydomain:80",
28
"unix",
29
"mydomain:80",
30
},
31
}
32
33
for _, c := range cases {
34
proto, addr := ProtocolAndAddress(c.fullAddr)
35
assert.Equal(t, proto, c.proto)
36
assert.Equal(t, addr, c.addr)
37
}
38
}