From 71decd73e3f84749d914cf5a48a55b80046ca052 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 30 Jan 2010 18:31:36 +0200 Subject: [PATCH] Allow tested functions to return NULL --- src/test/url.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/test/url.c b/src/test/url.c index 64060b5c2e..f4b665138d 100644 --- a/src/test/url.c +++ b/src/test/url.c @@ -37,12 +37,19 @@ static void test (conv_t f, const char *in, const char *out) { char *res; - printf ("\"%s\" -> \"%s\" ?\n", in, out); + if (out != NULL) + printf ("\"%s\" -> \"%s\" ?\n", in, out); + else + printf ("\"%s\" -> NULL ?\n", in); res = f (in); if (res == NULL) - exit (1); - - if (strcmp (res, out)) + { + if (out == NULL) + return; /* good: NULL -> NULL */ + puts (" ERROR: got NULL"); + exit (2); + } + if (out == NULL || strcmp (res, out)) { printf (" ERROR: got \"%s\"\n", res); exit (2); -- 2.39.2