-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader_test.go
More file actions
52 lines (44 loc) · 735 Bytes
/
loader_test.go
File metadata and controls
52 lines (44 loc) · 735 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
44
45
46
47
48
49
50
51
52
package mrpkg
import (
"reflect"
"testing"
)
type toNamedArgType struct{}
func (*toNamedArgType) ToNamedArgs() map[string]any {
return map[string]any{
"key1": 1,
"key2": 2,
}
}
type structArgType struct {
Key int `db:"key3"`
}
func TestMergeNamedArgs(t *testing.T) {
var (
arg1 = new(toNamedArgType)
arg2 = structArgType{
Key: 3,
}
arg3 = map[string]any{
"key4": 4,
"key5": 5,
}
)
expect := map[string]any{
"key1": 1,
"key2": 2,
"key3": 3,
"key4": 4,
"key5": 5,
"key6": 6,
}
got := MergeNamedArgs(map[string]any{
"arg1": arg1,
"arg2": arg2,
"arg3": arg3,
"key6": 6,
})
if !reflect.DeepEqual(expect, got) {
t.Errorf("MergeNamedArgs: expect=%v; got=%v", expect, got)
}
}