[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[libvirt] [PATCH v2 1/4] tests: virjson: Modify logic in testJSONFromString
- From: Peter Krempa <pkrempa redhat com>
- To: libvir-list redhat com
- Cc: Peter Krempa <pkrempa redhat com>
- Subject: [libvirt] [PATCH v2 1/4] tests: virjson: Modify logic in testJSONFromString
- Date: Tue, 11 Jul 2017 14:56:22 +0200
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.
---
tests/virjsontest.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index b9c210620..a5ffc4707 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:
--
2.12.2
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]