|
|
@@ -18,6 +18,15 @@ type TypeURLTestSuite struct {
|
|
18
|
18
|
suite.Suite
|
|
19
|
19
|
}
|
|
20
|
20
|
|
|
|
21
|
+func (suite *TypeURLTestSuite) TestUnmarshalNil() {
|
|
|
22
|
+ u, _ := url.Parse("https://google.com")
|
|
|
23
|
+
|
|
|
24
|
+ typ := &config.TypeURL{}
|
|
|
25
|
+ suite.NoError(typ.UnmarshalText(nil))
|
|
|
26
|
+ suite.Empty(typ.String())
|
|
|
27
|
+ suite.Equal("https://google.com", typ.Value(u).String())
|
|
|
28
|
+}
|
|
|
29
|
+
|
|
21
|
30
|
func (suite *TypeURLTestSuite) TestUnmarshalFail() {
|
|
22
|
31
|
testData := []string{
|
|
23
|
32
|
"http:/aaa.com",
|
|
|
@@ -26,6 +35,7 @@ func (suite *TypeURLTestSuite) TestUnmarshalFail() {
|
|
26
|
35
|
"://111",
|
|
27
|
36
|
"http://aaa.com:xxx",
|
|
28
|
37
|
"gopher://aaa.com:888",
|
|
|
38
|
+ "gopher://aaa.com",
|
|
29
|
39
|
}
|
|
30
|
40
|
|
|
31
|
41
|
for _, v := range testData {
|