On 9/4/21 4:44 PM, Ján Tomko wrote:
Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
tests/vshtabletest.c | 71 +++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 43 deletions(-)
diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c
index 569d7a852f..716b11dbc0 100644
--- a/tests/vshtabletest.c
+++ b/tests/vshtabletest.c
@@ -81,42 +81,38 @@ testVshTableHeader(const void *opaque G_GNUC_UNUSED)
static int
testVshTableRowAppend(const void *opaque G_GNUC_UNUSED)
{
- int ret = 0;
-
g_autoptr(vshTable) table = vshTableNew("Id", "Name", NULL);
if (!table)
- goto cleanup;
+ return -1;
if (vshTableRowAppend(table, NULL) >= 0) {
fprintf(stderr, "Appending NULL shouldn't work\n");
- ret = -1;
+ return -1;
}
if (vshTableRowAppend(table, "2", NULL) >= 0) {
fprintf(stderr, "Appending less items than in header\n");
- ret = -1;
+ return -1;
}
if (vshTableRowAppend(table, "2", "rhel7.5", "running",
NULL) >= 0) {
fprintf(stderr, "Appending more items than in header\n");
- ret = -1;
+ return -1;
}
if (vshTableRowAppend(table, "2", "rhel7.5", NULL) < 0) {
fprintf(stderr, "Appending same number of items as in header"
" should not return NULL\n");
- ret = -1;
+ return -1;
}
- cleanup:
- return ret;
+ return 0;
}
static int
testUnicode(const void *opaque G_GNUC_UNUSED)
{
- int ret = 0;
g_autofree char *act = NULL;
const char *exp =
@@ -128,7 +124,7 @@ testUnicode(const void *opaque G_GNUC_UNUSED)
table = vshTableNew("Id", "名稱", "государство", NULL);
if (!table)
- goto cleanup;
+ return -1;
This failure used to return 0, now returns -1. The new behavior is
correct, and fortunately it's mostly just a theoretical condition unless
the test system is actually out of memory, in which case it would have
aborted by now anyway (or possibly vshTableNew() could fail in some
strange way due to the Unicode characters, I haven't looked, and don't
feel like looking :-)).
(Really I'm just pointing it (and the things in the other mails) out so
you'll know that I really am looking at the diffs, and not just blindly
rubberstamping it :-)
:-)
Have I included enough text smiley emojis yet?
vshTableRowAppend(table, "1", "fedora28", "running", NULL);
vshTableRowAppend(table, "2", "つへソrhel7.5つへソ", "running",
@@ -136,17 +132,15 @@ testUnicode(const void *opaque G_GNUC_UNUSED)
act = vshTablePrintToString(table, true);
if (virTestCompareToString(exp, act) < 0)
- ret = -1;
+ return -1;
- cleanup:
- return ret;
+ return 0;
}
/* Point of this test is to see how table behaves with right to left writing */
static int
testUnicodeArabic(const void *opaque G_GNUC_UNUSED)
{
- int ret = 0;
g_autofree char *act = NULL;
const char *exp =
@@ -167,7 +161,7 @@ testUnicodeArabic(const void *opaque G_GNUC_UNUSED)
table = vshTableNew("ﻡﺍ ﻢﻣﺍ ﻕﺎﺌﻣﺓ", "ﺓ ﺎﻠﺼﻋ", "ﺍﻸﺜﻧﺎﻧ", NULL);
if (!table)
- goto cleanup;
+ return -1;
Same thing here. And there's probably others further down, but I'll shut
up now.