-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathissue90_test.go
More file actions
43 lines (37 loc) · 687 Bytes
/
issue90_test.go
File metadata and controls
43 lines (37 loc) · 687 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
36
37
38
39
40
41
42
43
package mergo_test
import (
"reflect"
"testing"
"dario.cat/mergo"
)
type structWithStringMap struct {
Data map[string]string
}
func TestIssue90(t *testing.T) {
dst := map[string]structWithStringMap{
"struct": {
Data: nil,
},
}
src := map[string]structWithStringMap{
"struct": {
Data: map[string]string{
"foo": "bar",
},
},
}
expected := map[string]structWithStringMap{
"struct": {
Data: map[string]string{
"foo": "bar",
},
},
}
err := mergo.Merge(&dst, src, mergo.WithOverride)
if err != nil {
t.Errorf("unexpected error %v", err)
}
if !reflect.DeepEqual(dst, expected) {
t.Errorf("expected: %#v\ngot: %#v", expected, dst)
}
}