Add some more cases to the app-id unit tests
[glib.git] / glib / tests / option-argv0.c
blob8ae00ca6fd9fd2dddbf12da71c5c5bddb1414c68
1 /*
2 * Copyright (C) 2011 Red Hat, Inc.
4 * This work is provided "as is"; redistribution and modification
5 * in whole or in part, in any medium, physical or electronic is
6 * permitted without restriction.
8 * This work is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * In no event shall the authors or contributors be liable for any
13 * direct, indirect, incidental, special, exemplary, or consequential
14 * damages (including, but not limited to, procurement of substitute
15 * goods or services; loss of use, data, or profits; or business
16 * interruption) however caused and on any theory of liability, whether
17 * in contract, strict liability, or tort (including negligence or
18 * otherwise) arising in any way out of the use of this software, even
19 * if advised of the possibility of such damage.
21 * Authors: Colin Walters <walters@verbum.org>
24 #include <glib.h>
26 #include <stdlib.h>
27 #include <stdio.h>
28 #include <string.h>
30 #if defined __linux || defined __OpenBSD__
31 static void
32 test_platform_argv0 (void)
34 GOptionContext *context;
35 gboolean arg;
36 GOptionEntry entries [] =
37 { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL },
38 { NULL } };
39 gboolean retval;
41 context = g_option_context_new (NULL);
42 g_option_context_add_main_entries (context, entries, NULL);
44 retval = g_option_context_parse (context, NULL, NULL, NULL);
45 g_assert (retval == TRUE);
46 g_assert (strcmp (g_get_prgname(), "option-argv0") == 0
47 || strcmp (g_get_prgname (), "lt-option-argv0") == 0);
49 g_option_context_free (context);
51 #endif
53 int
54 main (int argc,
55 char *argv[])
57 g_test_init (&argc, &argv, "no_g_set_prgname", NULL);
59 #if defined __linux || defined __OpenBSD__
60 g_test_add_func ("/option/argv0", test_platform_argv0);
61 #endif
63 return g_test_run ();