mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 03:44:01 +03:00
Add unmarshal nil for type url
This commit is contained in:
@@ -18,6 +18,15 @@ type TypeURLTestSuite struct {
|
|||||||
suite.Suite
|
suite.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *TypeURLTestSuite) TestUnmarshalNil() {
|
||||||
|
u, _ := url.Parse("https://google.com")
|
||||||
|
|
||||||
|
typ := &config.TypeURL{}
|
||||||
|
suite.NoError(typ.UnmarshalText(nil))
|
||||||
|
suite.Empty(typ.String())
|
||||||
|
suite.Equal("https://google.com", typ.Value(u).String())
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *TypeURLTestSuite) TestUnmarshalFail() {
|
func (suite *TypeURLTestSuite) TestUnmarshalFail() {
|
||||||
testData := []string{
|
testData := []string{
|
||||||
"http:/aaa.com",
|
"http:/aaa.com",
|
||||||
@@ -26,6 +35,7 @@ func (suite *TypeURLTestSuite) TestUnmarshalFail() {
|
|||||||
"://111",
|
"://111",
|
||||||
"http://aaa.com:xxx",
|
"http://aaa.com:xxx",
|
||||||
"gopher://aaa.com:888",
|
"gopher://aaa.com:888",
|
||||||
|
"gopher://aaa.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range testData {
|
for _, v := range testData {
|
||||||
|
|||||||
Reference in New Issue
Block a user