mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 09:55:46 +00:00
tests: virjson: Modify logic in testJSONFromString
To allow better testing in case where the string was parsed, modify the logic so that the regular code path is not included in a conditional block.
This commit is contained in:
parent
255cd95aab
commit
0a2866b42a
@ -27,24 +27,24 @@ testJSONFromString(const void *data)
|
|||||||
|
|
||||||
json = virJSONValueFromString(info->doc);
|
json = virJSONValueFromString(info->doc);
|
||||||
|
|
||||||
if (info->pass) {
|
if (!json) {
|
||||||
if (!json) {
|
if (info->pass) {
|
||||||
VIR_TEST_VERBOSE("Fail to parse %s\n", info->doc);
|
VIR_TEST_VERBOSE("Fail to parse %s\n", info->doc);
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
} else {
|
|
||||||
VIR_TEST_DEBUG("Parsed %s\n", info->doc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (json) {
|
|
||||||
VIR_TEST_VERBOSE("Should not have parsed %s\n", info->doc);
|
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
VIR_TEST_DEBUG("Fail to parse %s\n", info->doc);
|
VIR_TEST_DEBUG("Fail to parse %s\n", info->doc);
|
||||||
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!info->pass) {
|
||||||
|
VIR_TEST_VERBOSE("Should not have parsed %s\n", info->doc);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_TEST_DEBUG("Parsed %s\n", info->doc);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
Reference in New Issue
Block a user