Explorar el Código

Test unmarshal nil for type bytes

tags/v2.0.0-rc1
9seconds hace 5 años
padre
commit
1925efc2ec
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. 2
    2
      config/type_blocklist_uri_test.go
  2. 6
    0
      config/type_bytes_test.go

+ 2
- 2
config/type_blocklist_uri_test.go Ver fichero

30
 
30
 
31
 func (suite *TypeBlocklistURITestSuite) TestUnknownSchema() {
31
 func (suite *TypeBlocklistURITestSuite) TestUnknownSchema() {
32
 	typ := &config.TypeBlocklistURI{}
32
 	typ := &config.TypeBlocklistURI{}
33
-    suite.Error(typ.UnmarshalText([]byte("gopher://lalala")))
33
+	suite.Error(typ.UnmarshalText([]byte("gopher://lalala")))
34
 }
34
 }
35
 
35
 
36
 func (suite *TypeBlocklistURITestSuite) TestEmptyHost() {
36
 func (suite *TypeBlocklistURITestSuite) TestEmptyHost() {
37
 	typ := &config.TypeBlocklistURI{}
37
 	typ := &config.TypeBlocklistURI{}
38
-    suite.Error(typ.UnmarshalText([]byte("https:///path")))
38
+	suite.Error(typ.UnmarshalText([]byte("https:///path")))
39
 }
39
 }
40
 
40
 
41
 func (suite *TypeBlocklistURITestSuite) TestUnmarshalFail() {
41
 func (suite *TypeBlocklistURITestSuite) TestUnmarshalFail() {

+ 6
- 0
config/type_bytes_test.go Ver fichero

17
 	suite.Suite
17
 	suite.Suite
18
 }
18
 }
19
 
19
 
20
+func (suite *TypeBytesTestSuite) TestUnmarshalNil() {
21
+	typ := &config.TypeBytes{}
22
+	suite.NoError(typ.UnmarshalText(nil))
23
+	suite.Empty(typ.String())
24
+}
25
+
20
 func (suite *TypeBytesTestSuite) TestUnmarshalFail() {
26
 func (suite *TypeBytesTestSuite) TestUnmarshalFail() {
21
 	testData := []string{
27
 	testData := []string{
22
 		"1m",
28
 		"1m",

Loading…
Cancelar
Guardar