-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathutils_test.go
More file actions
32 lines (25 loc) · 821 Bytes
/
utils_test.go
File metadata and controls
32 lines (25 loc) · 821 Bytes
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
package main
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestHostDomainAndIP(t *testing.T) {
Convey("Test Host File Domain and IP regex", t, func() {
Convey("1.1.1.1 should be IP and not domain", func() {
So(isIP("1.1.1.1"), ShouldEqual, true)
So(isDomain("1.1.1.1"), ShouldEqual, false)
})
Convey("2001:470:20::2 should be IP and not domain", func() {
So(isIP("2001:470:20::2"), ShouldEqual, true)
So(isDomain("2001:470:20::2"), ShouldEqual, false)
})
Convey("`host` should not be domain and not IP", func() {
So(isDomain("host"), ShouldEqual, false)
So(isIP("host"), ShouldEqual, false)
})
Convey("`123.test` should be domain and not IP", func() {
So(isDomain("123.test"), ShouldEqual, true)
So(isIP("123.test"), ShouldEqual, false)
})
})
}