@@ -31,6 +31,10 @@ func TestPropertiesToMap(t *testing.T) { |
|
|
31 |
31 |
foo.bar=asdf |
32 |
32 |
foo.baz=zxcv |
33 |
33 |
bar.bat.bam=123 |
|
34 |
+ qux.a=x |
|
35 |
+ qux.a.b=y |
|
36 |
+ fuz.a.b=y |
|
37 |
+ fuz.a=x |
34 |
38 |
`) |
35 |
39 |
propertiesInput, err := properties.LoadFromBytes(rawProperties) |
36 |
40 |
require.Nil(t, err) |
@@ -41,6 +45,10 @@ func TestPropertiesToMap(t *testing.T) { |
|
|
41 |
45 |
"foo.bar": "asdf", |
42 |
46 |
"foo.baz": "zxcv", |
43 |
47 |
"bar.bat.bam": "123", |
|
48 |
+"qux.a": "x", |
|
49 |
+"qux.a.b": "y", |
|
50 |
+"fuz.a.b": "y", |
|
51 |
+"fuz.a": "x", |
44 |
52 |
} |
45 |
53 |
|
46 |
54 |
assert.True(t, reflect.DeepEqual(expectedMapOutput, PropertiesToMap(propertiesInput, 1))) |
@@ -55,6 +63,14 @@ func TestPropertiesToMap(t *testing.T) { |
|
|
55 |
63 |
"bar": map[string]interface{}{ |
56 |
64 |
"bat.bam": "123", |
57 |
65 |
}, |
|
66 |
+"qux": map[string]interface{}{ |
|
67 |
+"a": "x", |
|
68 |
+"a.b": "y", |
|
69 |
+ }, |
|
70 |
+"fuz": map[string]interface{}{ |
|
71 |
+"a.b": "y", |
|
72 |
+"a": "x", |
|
73 |
+ }, |
58 |
74 |
} |
59 |
75 |
|
60 |
76 |
assert.True(t, reflect.DeepEqual(expectedMapOutput, PropertiesToMap(propertiesInput, 2))) |
@@ -71,6 +87,16 @@ func TestPropertiesToMap(t *testing.T) { |
|
|
71 |
87 |
"bam": "123", |
72 |
88 |
}, |
73 |
89 |
}, |
|
90 |
+"qux": map[string]interface{}{ |
|
91 |
+"a": map[string]interface{}{ |
|
92 |
+"b": "y", // It is impossible to represent the complete "properties" data structure recursed to this depth. |
|
93 |
+ }, |
|
94 |
+ }, |
|
95 |
+"fuz": map[string]interface{}{ |
|
96 |
+"a": map[string]interface{}{ |
|
97 |
+"b": "y", |
|
98 |
+ }, |
|
99 |
+ }, |
74 |
100 |
} |
75 |
101 |
|
76 |
102 |
assert.True(t, reflect.DeepEqual(expectedMapOutput, PropertiesToMap(propertiesInput, 3))) |