utils/utils_test.go

47 lines
526 B
Go
Raw Permalink Normal View History

2024-05-09 10:59:14 +08:00
package utils
import (
"testing"
)
func TestDeepSearch(t *testing.T) {
m := map[string]any{
"a": 1,
"b": map[string]any{
"c": 2,
},
}
mb := DeepSearch(m, []string{"b", "a"})
t.Log(m)
mb["cc"] = "3"
t.Log(m)
}
func TestMergeMap(t *testing.T) {
m1 := map[string]any{
"a": 1,
"b": map[string]any{
"c": 2,
"a": 1,
"b": map[string]any{
"c": 2,
"a": 1,
},
},
}
m2 := map[string]any{
"a": 11,
"b": map[string]any{
"c": 22,
"cc": 33,
},
}
t.Log(MergeMap(m1, m2))
}