Coverage default.go
This commit is contained in:
		| @@ -31,6 +31,9 @@ func (c *cfg) Validate() error { | |||||||
| 	if c.IntValue != 10 { | 	if c.IntValue != 10 { | ||||||
| 		return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue) | 		return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue) | ||||||
| 	} | 	} | ||||||
|  | 	if c.MapValue["key1"] != true { | ||||||
|  | 		return fmt.Errorf("invalid MapValue %t != %t", true, c.MapValue["key1"]) | ||||||
|  | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -105,3 +108,19 @@ func TestValidate(t *testing.T) { | |||||||
| 		t.Fatal(err) | 		t.Fatal(err) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func TestString(t *testing.T) { | ||||||
|  | 	cfg := config.NewConfig() | ||||||
|  | 	res := cfg.String() | ||||||
|  | 	if res != "default" { | ||||||
|  | 		t.Fatalf("string value invalid: %s", res) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestName(t *testing.T) { | ||||||
|  | 	cfg := config.NewConfig() | ||||||
|  | 	res := cfg.Name() | ||||||
|  | 	if res != "" { | ||||||
|  | 		t.Fatal("name value not empty") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user