forked from eddycjy/agollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_test.go
50 lines (38 loc) 路 824 Bytes
/
utils_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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package agollo
import (
"testing"
"strings"
"github.com/zouyx/agollo/test"
)
func TestGetInternal(t *testing.T) {
//fmt.Println("Usage of ./getmyip --get_ip=(external|internal)")
//flag.Parse()
ip:=getInternal()
t.Log("Internal ip:",ip)
nums:=strings.Split(ip,".")
test.Equal(t,true,len(nums)>0)
}
func TestIsEmpty(t *testing.T) {
flag:=isEmpty("")
test.Equal(t,true,flag)
flag=isEmpty("abc")
test.Equal(t,false,flag)
}
func TestIsNotEmpty(t *testing.T) {
flag:=isNotEmpty("")
test.Equal(t,false,flag)
flag=isNotEmpty("abc")
test.Equal(t,true,flag)
}
func TestIsNil(t *testing.T) {
flag:=isNil(nil)
test.Equal(t,true,flag)
flag=isNil("")
test.Equal(t,false,flag)
}
func TestIsNotNil(t *testing.T) {
flag:=isNotNil(nil)
test.Equal(t,false,flag)
flag=isNotNil("")
test.Equal(t,true,flag)
}