Two things are happening here:
1) Call to virTestDifference() is guarded by '!result ||
STRNEQ(result, _)' check. This is suboptimal since we have
STRNEQ_NULLABLE().
2) There are couple of VIR_TEST_DEBUG() printings, which are
useless. If debug is off they don't print anything, and if it
is on, then much more information is printed by subsequent
virTestDifference().
This makes the STRNEQ() + virTestDifference() combo look similar
to the rest of tests and thus can be picked up by spatch later.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/virbuftest.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 0ca7927c3f..144df6e66b 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -92,7 +92,7 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUSED)
virBufferAddChar(buf, '\n');
result = virBufferContentAndReset(buf);
- if (!result || STRNEQ(result, expected)) {
+ if (STRNEQ_NULLABLE(result, expected)) {
virTestDifference(stderr, expected, result);
ret = -1;
}
@@ -122,7 +122,7 @@ static int testBufTrim(const void *data G_GNUC_UNUSED)
virBufferTrim(buf, ",,");
result = virBufferContentAndReset(buf);
- if (!result || STRNEQ(result, expected)) {
+ if (STRNEQ_NULLABLE(result, expected)) {
virTestDifference(stderr, expected, result);
return -1;
}
@@ -146,7 +146,6 @@ testBufTrimChars(const void *opaque)
}
if (STRNEQ_NULLABLE(actual, data->expect)) {
- VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:");
virTestDifference(stderr, data->expect, actual);
return -1;
}
@@ -278,7 +277,6 @@ testBufAddStr(const void *opaque)
}
if (STRNEQ_NULLABLE(actual, data->expect)) {
- VIR_TEST_DEBUG("testBufAddStr(): Strings don't match:");
virTestDifference(stderr, data->expect, actual);
return -1;
}
@@ -306,7 +304,6 @@ testBufEscapeStr(const void *opaque)
}
if (STRNEQ_NULLABLE(actual, data->expect)) {
- VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:");
virTestDifference(stderr, data->expect, actual);
return -1;
}
@@ -330,7 +327,6 @@ testBufEscapeRegex(const void *opaque)
}
if (STRNEQ_NULLABLE(actual, data->expect)) {
- VIR_TEST_DEBUG("testBufEscapeRegex: Strings don't match:");
virTestDifference(stderr, data->expect, actual);
return -1;
}
--
2.37.4