jsontest: Add test cases for deflattening of arrays

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2020-03-18 17:02:42 +01:00
parent 070310a680
commit cdf82b60fd
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,27 @@
{
"valid": {
"0": "test",
"1": { "something": 123 },
"2": true
},
"outoforder": {
"1": { "something": 123 },
"2": true,
"0": "test"
},
"invalid-overflow": {
"1": { "something": 123 },
"2": true,
"4": "test"
},
"invalid-strings": {
"1": { "something": 123 },
"2": true,
"test": "test"
},
"nestedkeys": {
"test.0.test": 123,
"test.2.test": 123,
"test.1.test": 123
}
}

View File

@ -0,0 +1,43 @@
{
"valid": [
"test",
{
"something": 123
},
true
],
"outoforder": [
"test",
{
"something": 123
},
true
],
"invalid-overflow": {
"1": {
"something": 123
},
"2": true,
"4": "test"
},
"invalid-strings": {
"1": {
"something": 123
},
"2": true,
"test": "test"
},
"nestedkeys": {
"test": [
{
"test": 123
},
{
"test": 123
},
{
"test": 123
}
]
}
}

View File

@ -609,6 +609,7 @@ mymain(void)
DO_TEST_DEFLATTEN("concat", true);
DO_TEST_DEFLATTEN("concat-double-key", false);
DO_TEST_DEFLATTEN("qemu-sheepdog", true);
DO_TEST_DEFLATTEN("dotted-array", true);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}