Check the return value of g_get_prgname for NULL before passing to strcmp.

2006-04-05  Behdad Esfahbod  <behdad@gnome.org>

        * tests/option-test.c: Check the return value of g_get_prgname for
        NULL before passing to strcmp.

        * tests/slice-test.c: Report the correct name in Usage summary.
This commit is contained in:
Behdad Esfahbod
2006-04-05 05:56:47 +00:00
committed by Behdad Esfahbod
parent 5525aa52c9
commit 8741c8bf5a
4 changed files with 18 additions and 2 deletions

View File

@@ -916,6 +916,7 @@ empty_test1 (void)
GOptionContext *context;
GOptionEntry entries [] =
{ { NULL } };
char *prgname;
g_set_prgname (NULL);
context = g_option_context_new (NULL);
@@ -924,7 +925,8 @@ empty_test1 (void)
g_option_context_parse (context, NULL, NULL, NULL);
g_assert (strcmp (g_get_prgname (), "<unknown>") == 0);
prgname = g_get_prgname ();
g_assert (prgname && strcmp (prgname, "<unknown>") == 0);
g_option_context_free (context);
}