mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
070310a680
commit
cdf82b60fd
27
tests/virjsondata/deflatten-dotted-array-in.json
Normal file
27
tests/virjsondata/deflatten-dotted-array-in.json
Normal 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
|
||||
}
|
||||
}
|
43
tests/virjsondata/deflatten-dotted-array-out.json
Normal file
43
tests/virjsondata/deflatten-dotted-array-out.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user