@@ -12,7 +12,7 @@ func TestFlatten(t *testing.T) {
12
12
options * Options
13
13
want map [string ]interface {}
14
14
}{
15
- // test with different primitives
15
+ // test with different primitives and upper/lower case
16
16
// String: 'world',
17
17
// Number: 1234.99,
18
18
// Boolean: true,
@@ -22,6 +22,11 @@ func TestFlatten(t *testing.T) {
22
22
nil ,
23
23
map [string ]interface {}{"hello" : "world" },
24
24
},
25
+ {
26
+ `{"Hello": "world"}` ,
27
+ nil ,
28
+ map [string ]interface {}{"Hello" : "world" },
29
+ },
25
30
{
26
31
`{"hello": 1234.99}` ,
27
32
nil ,
@@ -48,6 +53,21 @@ func TestFlatten(t *testing.T) {
48
53
nil ,
49
54
map [string ]interface {}{"hello.world" : "good morning" },
50
55
},
56
+ {
57
+ `{"Hello":{"world":"good morning"}}` ,
58
+ nil ,
59
+ map [string ]interface {}{"Hello.world" : "good morning" },
60
+ },
61
+ {
62
+ `{"hello":{"World":"good morning"}}` ,
63
+ nil ,
64
+ map [string ]interface {}{"hello.World" : "good morning" },
65
+ },
66
+ {
67
+ `{"Hello":{"World":"good morning"}}` ,
68
+ nil ,
69
+ map [string ]interface {}{"Hello.World" : "good morning" },
70
+ },
51
71
{
52
72
`{"hello":{"world":1234.99}}` ,
53
73
nil ,
@@ -185,6 +205,12 @@ func TestUnflatten(t *testing.T) {
185
205
nil ,
186
206
map [string ]interface {}{"hello" : "world" },
187
207
},
208
+ // Key starts with upper case
209
+ {
210
+ map [string ]interface {}{"Hello" : "world" },
211
+ nil ,
212
+ map [string ]interface {}{"Hello" : "world" },
213
+ },
188
214
{
189
215
map [string ]interface {}{"hello" : 1234.56 },
190
216
nil ,
@@ -233,6 +259,44 @@ func TestUnflatten(t *testing.T) {
233
259
},
234
260
},
235
261
},
262
+ // multiple keys - key starts with upper case
263
+ {
264
+ map [string ]interface {}{
265
+ "Hello.lorem.ipsum" : "L1 upper" ,
266
+ "hello.lorem.ipsum" : "L1 lower" ,
267
+ "hello.Lorem.dolor" : "L2 upper" ,
268
+ "hello.lorem.dolor" : "L2 lower" ,
269
+ "world.lorem.Ipsum" : "L3 upper" ,
270
+ "world.lorem.ipsum" : "L3 lower" ,
271
+ "world.lorem.dolor" : "sit" ,
272
+ "world" : map [string ]interface {}{
273
+ "greet" : "hello" ,
274
+ "From" : "alice" ,
275
+ },
276
+ },
277
+ nil ,
278
+ map [string ]interface {}{
279
+ "hello" : map [string ]interface {}{
280
+ "lorem" : map [string ]interface {}{
281
+ "ipsum" : "L1 lower" ,
282
+ "dolor" : "L2 lower" ,
283
+ },
284
+ "Lorem" : map [string ]interface {}{"dolor" : "L2 upper" },
285
+ },
286
+ "Hello" : map [string ]interface {}{
287
+ "lorem" : map [string ]interface {}{"ipsum" : "L1 upper" },
288
+ },
289
+ "world" : map [string ]interface {}{
290
+ "greet" : "hello" ,
291
+ "From" : "alice" ,
292
+ "lorem" : map [string ]interface {}{
293
+ "ipsum" : "L3 lower" ,
294
+ "Ipsum" : "L3 upper" ,
295
+ "dolor" : "sit" ,
296
+ },
297
+ },
298
+ },
299
+ },
236
300
// nested objects do not clobber each other
237
301
{
238
302
map [string ]interface {}{
0 commit comments