forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
join_test.go
27 lines (24 loc) · 965 Bytes
/
join_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCheckAddrFormat(t *testing.T) {
assert.False(t, checkAddrFormat("1.1.1.1"))
assert.False(t, checkAddrFormat("hostname"))
assert.False(t, checkAddrFormat("1.1.1.1:"))
assert.False(t, checkAddrFormat("hostname:"))
assert.False(t, checkAddrFormat("1.1.1.1:111111"))
assert.False(t, checkAddrFormat("hostname:111111"))
assert.False(t, checkAddrFormat("http://1.1.1.1"))
assert.False(t, checkAddrFormat("http://hostname"))
assert.False(t, checkAddrFormat("http://1.1.1.1:1"))
assert.False(t, checkAddrFormat("http://hostname:1"))
assert.False(t, checkAddrFormat(":1.1.1.1"))
assert.False(t, checkAddrFormat(":hostname"))
assert.False(t, checkAddrFormat(":1.1.1.1:1"))
assert.False(t, checkAddrFormat(":hostname:1"))
assert.True(t, checkAddrFormat("1.1.1.1:1111"))
assert.True(t, checkAddrFormat("hostname:1111"))
assert.True(t, checkAddrFormat("host-name_42:1111"))
}