test: fix __NMTST_LOG() macro to allow format-string-only argument
We want to be able to call __NMTST_LOG(g_message, "hallo"); without additional format string arguments.
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
|
#include "nm-utils-internal.h"
|
||||||
#include "nm-glib-compat.h"
|
#include "nm-glib-compat.h"
|
||||||
#include "gsystem-local-alloc.h"
|
#include "gsystem-local-alloc.h"
|
||||||
|
|
||||||
@@ -91,13 +92,13 @@ nmtst_initialized (void)
|
|||||||
return !!__nmtst_internal.rand0;
|
return !!__nmtst_internal.rand0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __NMTST_LOG(cmd, fmt, ...) \
|
#define __NMTST_LOG(cmd, ...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
g_assert (nmtst_initialized ()); \
|
g_assert (nmtst_initialized ()); \
|
||||||
if (!__nmtst_internal.assert_logging || __nmtst_internal.no_expect_message) { \
|
if (!__nmtst_internal.assert_logging || __nmtst_internal.no_expect_message) { \
|
||||||
cmd (fmt, __VA_ARGS__); \
|
cmd (__VA_ARGS__); \
|
||||||
} else { \
|
} else { \
|
||||||
printf (fmt "\n", __VA_ARGS__); \
|
printf (_NM_UTILS_MACRO_FIRST (__VA_ARGS__) "\n" _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
|
||||||
} \
|
} \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user