aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpg/t-support.h
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-01-12 13:01:00 +0000
committerJustus Winter <[email protected]>2017-01-12 13:18:15 +0000
commit186dcd3494eda7383de57a530fd15776410531a5 (patch)
tree56a2ca667d016fa641daa01f065a03b672f1e5c5 /tests/gpg/t-support.h
parenttests: Enable gpgconf test. (diff)
downloadgpgme-186dcd3494eda7383de57a530fd15776410531a5.tar.gz
gpgme-186dcd3494eda7383de57a530fd15776410531a5.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--tests/gpg/t-support.h28
1 files changed, 28 insertions, 0 deletions
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)
{