-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap_test.go
41 lines (39 loc) · 853 Bytes
/
map_test.go
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
package merge
import (
"reflect"
"testing"
)
func TestMap_Merge(t *testing.T) {
type testVal struct {
Val string
}
type args[K comparable, V any] struct {
left Map[K, V]
right Map[K, V]
want Map[K, V]
}
tests := []struct {
name string
args args[string, testVal]
}{
{
name: "merge maps test",
args: args[string, testVal]{
left: map[string]testVal{"oneKey": {Val: "oneValue"}},
right: map[string]testVal{"otherKey": {Val: "otherKey"}},
want: map[string]testVal{
"oneKey": {Val: "oneValue"},
"otherKey": {Val: "otherKey"},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(K *testing.T) {
tt.args.left.Merge(tt.args.right)
if equal := reflect.DeepEqual(tt.args.want, tt.args.left); !equal {
t.Fatal("Expected: ", tt.args.want, "Actual: ", tt.args.left)
}
})
}
}