virbuftest: use field names when initalizing test info

Allow adding new fields without changing all the macros.

Otherwise the compiler complains that not all have been initialized:
../../tests/virbuftest.c:419:5: error: missing field 'arg' initializer [-Werror,-Wmissing-field-initializers]
    DO_TEST_ESCAPE("<td></td><td></td>",
    ^
../../tests/virbuftest.c:414:56: note: expanded from macro 'DO_TEST_ESCAPE'
        struct testBufAddStrData info = { data, expect }; \

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Ján Tomko 2020-01-14 08:06:34 +01:00
parent ebd44715f1
commit 46afdc2120

View File

@ -372,9 +372,9 @@ mymain(void)
DO_TEST("set indent", testBufSetIndent);
DO_TEST("autoclean", testBufferAutoclean);
#define DO_TEST_ADD_STR(DATA, EXPECT) \
#define DO_TEST_ADD_STR(_data, _expect) \
do { \
struct testBufAddStrData info = { DATA, EXPECT }; \
struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
if (virTestRun("Buf: AddStr", testBufAddStr, &info) < 0) \
ret = -1; \
} while (0)
@ -384,9 +384,9 @@ mymain(void)
DO_TEST_ADD_STR("<a/>\n", "<c>\n <a/>\n</c>");
DO_TEST_ADD_STR("<b>\n <a/>\n</b>\n", "<c>\n <b>\n <a/>\n </b>\n</c>");
#define DO_TEST_ESCAPE(data, expect) \
#define DO_TEST_ESCAPE(_data, _expect) \
do { \
struct testBufAddStrData info = { data, expect }; \
struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
if (virTestRun("Buf: EscapeStr", testBufEscapeStr, &info) < 0) \
ret = -1; \
} while (0)
@ -400,9 +400,9 @@ mymain(void)
DO_TEST_ESCAPE("\x01\x01\x02\x03\x05\x08",
"<c>\n <el></el>\n</c>");
#define DO_TEST_ESCAPE_REGEX(data, expect) \
#define DO_TEST_ESCAPE_REGEX(_data, _expect) \
do { \
struct testBufAddStrData info = { data, expect }; \
struct testBufAddStrData info = { .data = _data, .expect = _expect }; \
if (virTestRun("Buf: EscapeRegex", testBufEscapeRegex, &info) < 0) \
ret = -1; \
} while (0)