-
-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathissue121_test.go
More file actions
35 lines (28 loc) · 656 Bytes
/
issue121_test.go
File metadata and controls
35 lines (28 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package mergo_test
import (
"testing"
"dario.cat/mergo"
)
func TestIssue121WithSliceDeepCopy(t *testing.T) {
dst := map[string]interface{}{
"inter": map[string]interface{}{
"a": "1",
"b": "2",
},
}
src := map[string]interface{}{
"inter": map[string]interface{}{
"a": "3",
"c": "4",
},
}
if err := mergo.Merge(&dst, src, mergo.WithSliceDeepCopy); err != nil {
t.Errorf("Error during the merge: %v", err)
}
if dst["inter"].(map[string]interface{})["a"].(string) != "3" {
t.Error("inter.a should equal '3'")
}
if dst["inter"].(map[string]interface{})["c"].(string) != "4" {
t.Error("inter.c should equal '4'")
}
}