mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
* libs/common: Refactor libs/common 5 - move mathematical functions and types out of `libs/common` to math pkg - move net functions out of `libs/common` to net pkg - move string functions out of `libs/common` to strings pkg - move async functions out of `libs/common` to async pkg - move bit functions out of `libs/common` to bits pkg - move cmap functions out of `libs/common` to cmap pkg - move os functions out of `libs/common` to os pkg Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * fix testing issues * fix tests closes #41417 woooooooooooooooooo kill the cmn pkg Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * add changelog entry * fix goimport issues * run gofmt
39 lines
528 B
Go
39 lines
528 B
Go
package net
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestProtocolAndAddress(t *testing.T) {
|
|
|
|
cases := []struct {
|
|
fullAddr string
|
|
proto string
|
|
addr string
|
|
}{
|
|
{
|
|
"tcp://mydomain:80",
|
|
"tcp",
|
|
"mydomain:80",
|
|
},
|
|
{
|
|
"mydomain:80",
|
|
"tcp",
|
|
"mydomain:80",
|
|
},
|
|
{
|
|
"unix://mydomain:80",
|
|
"unix",
|
|
"mydomain:80",
|
|
},
|
|
}
|
|
|
|
for _, c := range cases {
|
|
proto, addr := ProtocolAndAddress(c.fullAddr)
|
|
assert.Equal(t, proto, c.proto)
|
|
assert.Equal(t, addr, c.addr)
|
|
}
|
|
}
|