feat(Go-StudyExample):2021/02/09:新增merge源码阅读和单测代码
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package mergo_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
)
|
||||
|
||||
type mapInterface map[string]interface{}
|
||||
|
||||
func TestMergeMapsEmptyString(t *testing.T) {
|
||||
a := mapInterface{"s": ""}
|
||||
b := mapInterface{"s": "foo"}
|
||||
if err := mergo.Merge(&a, b); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if a["s"] != "foo" {
|
||||
t.Errorf("b not merged in properly: a.s.Value(%s) != expected(%s)", a["s"], "foo")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user