From 186dcd3494eda7383de57a530fd15776410531a5 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 12 Jan 2017 14:01:00 +0100 Subject: tests: Improve the gpgconf test. * tests/gpg/t-gpgconf.c: Include support functions. (fail_if_err): Remove macro. (init_gpgme): Remove function. (lookup): New function. (main): Update some values and verify that the changes are applied. * tests/gpg/t-support.h (test): New assert-like macro. GnuPG-bug-id: 2881 Signed-off-by: Justus Winter --- tests/gpg/t-support.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/gpg/t-support.h') diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h index db69dd0e..f6dec682 100644 --- a/tests/gpg/t-support.h +++ b/tests/gpg/t-support.h @@ -48,6 +48,34 @@ while (0) +#ifdef GPGRT_HAVE_MACRO_FUNCTION +void GPGRT_ATTR_NORETURN +_test (const char *expr, const char *file, int line, + const char *func) +{ + fprintf (stderr, "Test \"%s\" in %s failed (%s:%d)\n", + expr, func, file, line); + exit (1); +} +# define test(expr) \ + ((expr) \ + ? (void) 0 \ + : _test (#expr, __FILE__, __LINE__, __FUNCTION__)) +#else /*!GPGRT_HAVE_MACRO_FUNCTION*/ +void +_test (const char *expr, const char *file, int line) +{ + fprintf (stderr, "Test \"%s\" failed (%s:%d)\n", + expr, file, line); + exit (1); +} +# define test(expr) \ + ((expr) \ + ? (void) 0 \ + : _test (#expr, __FILE__, __LINE__)) +#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/ + + static const char * nonnull (const char *s) { -- cgit v1.2.3