]> git.sesse.net Git - vlc/commitdiff
Allow tested functions to return NULL
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 30 Jan 2010 16:31:36 +0000 (18:31 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 30 Jan 2010 16:34:30 +0000 (18:34 +0200)
src/test/url.c

index 64060b5c2eb6b80fe2e4958f9806588918fb39c7..f4b665138dbe28fb674aeeecd58ce5dc6b837a26 100644 (file)
@@ -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);