From 1fd0ebea9b6f8d3fa152c96263ac4e642c4c4805 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Thu, 1 Apr 2021 21:33:14 +0300 Subject: [PATCH] Add unmarshal nil for type url --- config/type_url_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/type_url_test.go b/config/type_url_test.go index 0ab8e5a..1e7ccdb 100644 --- a/config/type_url_test.go +++ b/config/type_url_test.go @@ -18,6 +18,15 @@ type TypeURLTestSuite struct { 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() { testData := []string{ "http:/aaa.com", @@ -26,6 +35,7 @@ func (suite *TypeURLTestSuite) TestUnmarshalFail() { "://111", "http://aaa.com:xxx", "gopher://aaa.com:888", + "gopher://aaa.com", } for _, v := range testData {