vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Nov 6 00:09:48 2016 +0200| [e2a296bef09da3cc72a37c7f185d221e1bb6380b] | committer: Rémi Denis-Courmont
url: only print out failed tests > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e2a296bef09da3cc72a37c7f185d221e1bb6380b --- src/test/url.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/test/url.c b/src/test/url.c index de2bf47..bdfb1de 100644 --- a/src/test/url.c +++ b/src/test/url.c @@ -40,27 +40,33 @@ typedef char * (*conv_t) (const char *); static void test (conv_t f, const char *in, const char *out) { - char *res; + char *res = f(in); - if (out != NULL) - printf ("\"%s\" -> \"%s\" ?\n", in, out); - else - printf ("\"%s\" -> NULL ?\n", in); - res = f (in); if (res == NULL) { if (out == NULL) return; /* good: NULL -> NULL */ - puts (" ERROR: got NULL"); - exit (2); + + fprintf(stderr, "\"%s\" returned NULL, expected \"%s\"", in, out); + exit(2); + } + + if (out == NULL) + { + fprintf(stderr, "\"%s\" returned \"%s\", expected NULL", in, res); + free(res); + exit(2); } - if (out == NULL || strcmp (res, out)) + + if (strcmp(res, out)) { - printf (" ERROR: got \"%s\"\n", res); - exit (2); + fprintf(stderr, "\"%s\" returned \"%s\", expected \"%s\"\n", in, res, + out); + free(res); + exit(2); } - free (res); + free(res); } static inline void test_decode (const char *in, const char *out) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
