Test unmarshal nil for type bytes

This commit is contained in:
9seconds
2021-04-01 16:54:00 +03:00
parent 9562a86038
commit 1925efc2ec
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -30,12 +30,12 @@ func (suite *TypeBlocklistURITestSuite) TestUnmarshalNil() {
func (suite *TypeBlocklistURITestSuite) TestUnknownSchema() {
typ := &config.TypeBlocklistURI{}
suite.Error(typ.UnmarshalText([]byte("gopher://lalala")))
suite.Error(typ.UnmarshalText([]byte("gopher://lalala")))
}
func (suite *TypeBlocklistURITestSuite) TestEmptyHost() {
typ := &config.TypeBlocklistURI{}
suite.Error(typ.UnmarshalText([]byte("https:///path")))
suite.Error(typ.UnmarshalText([]byte("https:///path")))
}
func (suite *TypeBlocklistURITestSuite) TestUnmarshalFail() {
+6
View File
@@ -17,6 +17,12 @@ type TypeBytesTestSuite struct {
suite.Suite
}
func (suite *TypeBytesTestSuite) TestUnmarshalNil() {
typ := &config.TypeBytes{}
suite.NoError(typ.UnmarshalText(nil))
suite.Empty(typ.String())
}
func (suite *TypeBytesTestSuite) TestUnmarshalFail() {
testData := []string{
"1m",