File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1- v2.0.4
1+ v2.0.5
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ import (
77 "time"
88)
99
10+ func NewFlesh (thing interface {}) Flesh {
11+ return & figFlesh {Flesh : thing }
12+ }
13+
1014func (flesh * figFlesh ) ToString () string {
1115 f , _ := toString (flesh .Flesh )
1216 return f
Original file line number Diff line number Diff line change @@ -7,6 +7,14 @@ import (
77 "github.com/stretchr/testify/assert"
88)
99
10+ func TestNewFlesh (t * testing.T ) {
11+ assert .NotNil (t , NewFlesh (t .Name ()))
12+ assert .Equal (t , t .Name (), NewFlesh (t .Name ()).ToString ())
13+ assert .Equal (t , 0 , NewFlesh (t .Name ()).ToInt ())
14+ assert .Equal (t , map [string ]string {}, NewFlesh (t .Name ()).ToMap ())
15+ assert .Equal (t , []string {t .Name ()}, NewFlesh (t .Name ()).ToList ())
16+ }
17+
1018func TestFleshInterface (t * testing.T ) {
1119 t .Run ("Is" , func (t * testing.T ) {
1220 t .Run ("Map" , func (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -65,20 +65,36 @@ func (tree *figTree) validateAll() error {
6565 if fruit != nil && validator != nil {
6666 var val interface {}
6767 switch v := fruit .Flesh .Flesh .(type ) {
68+ case int :
69+ val = v
6870 case * int :
6971 val = * v
72+ case int64 :
73+ val = v
7074 case * int64 :
7175 val = * v
76+ case float64 :
77+ val = v
7278 case * float64 :
7379 val = * v
80+ case string :
81+ val = v
7482 case * string :
7583 val = * v
84+ case bool :
85+ val = v
7686 case * bool :
7787 val = * v
88+ case time.Duration :
89+ val = v
7890 case * time.Duration :
7991 val = * v
92+ case ListFlag :
93+ val = v .values
8094 case * ListFlag :
8195 val = * v .values
96+ case MapFlag :
97+ val = v .values
8298 case * MapFlag :
8399 val = * v .values
84100 }
You can’t perform that action at this time.
0 commit comments