123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package conf_test
- import (
- "leafstalk/conf"
- "testing"
- )
- func TestCompareMaps(t *testing.T) {
- map1 := map[string]interface{}{
- "key1": 5,
- "key2": "hello",
- "key3": true,
- "key4": 3.14,
- "key5": []int{1, 2, 3},
- "key6": map[string]interface{}{
- "nestedKey1": "nestedValue1",
- "nestedKey2": 10,
- },
- "key7": []map[string]int{
- {"nestedKey3": 20},
- {"nestedKey4": 30},
- },
- "key8": [3]string{"a", "b", "c"},
- }
- map2 := map[string]interface{}{
- "key1": 5,
- "key2": "world",
- "key3": true,
- "key4": 3.14,
- "key5": []int{1, 2, 3},
- "key6": map[string]interface{}{
- "nestedKey1": "nestedValue2",
- "nestedKey2": 10,
- },
- "key7": []map[string]int{
- {"nestedKey3": 20},
- {"nestedKey4": 40},
- },
- "key8": [3]string{"a", "b", "d"},
- }
- diffKeys := conf.CompareMaps(map1, map2)
- t.Logf("diffKeys:%v", diffKeys)
- }
|