diff --git a/tests/virjsontest.c b/tests/virjsontest.c index b9c2106207..a5ffc47074 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -27,24 +27,24 @@ testJSONFromString(const void *data) json = virJSONValueFromString(info->doc); - if (info->pass) { - if (!json) { + if (!json) { + if (info->pass) { 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; } else { 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; cleanup: