From: RĂ©mi Denis-Courmont Date: Sat, 30 Jan 2010 16:31:36 +0000 (+0200) Subject: Allow tested functions to return NULL X-Git-Tag: 1.1.0-ff~660 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=71decd73e3f84749d914cf5a48a55b80046ca052;p=vlc Allow tested functions to return NULL --- 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);