feat(Go-StudyExample):2021/02/09:新增merge源码阅读和单测代码
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package mergo_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
)
|
||||
|
||||
func TestIssue61MergeNilMap(t *testing.T) {
|
||||
type T struct {
|
||||
I map[string][]string
|
||||
}
|
||||
t1 := T{}
|
||||
t2 := T{I: map[string][]string{"hi": {"there"}}}
|
||||
|
||||
if err := mergo.Merge(&t1, t2); err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(t2, T{I: map[string][]string{"hi": {"there"}}}) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user