mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-20 14:19:16 +02:00
More test fixes
This commit is contained in:
parent
0163a3808c
commit
a1b1b4f47a
@ -1,5 +1,9 @@
|
|||||||
2006-04-05 Matthias Clasen <mclasen@redhat.com>
|
2006-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* tests/option-test.c (arg_test5): Skip the test if
|
||||||
|
setting the locale fails.
|
||||||
|
(empty_test1): Reset prgname before the test.
|
||||||
|
|
||||||
* tests/Makefile.am: Arrange for run-bookmark-test.sh
|
* tests/Makefile.am: Arrange for run-bookmark-test.sh
|
||||||
to be run by make check.
|
to be run by make check.
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
2006-04-05 Matthias Clasen <mclasen@redhat.com>
|
2006-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* tests/option-test.c (arg_test5): Skip the test if
|
||||||
|
setting the locale fails.
|
||||||
|
(empty_test1): Reset prgname before the test.
|
||||||
|
|
||||||
* tests/Makefile.am: Arrange for run-bookmark-test.sh
|
* tests/Makefile.am: Arrange for run-bookmark-test.sh
|
||||||
to be run by make check.
|
to be run by make check.
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <glib.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
int error_test1_int;
|
int error_test1_int;
|
||||||
char *error_test2_string;
|
char *error_test2_string;
|
||||||
@ -370,7 +371,8 @@ arg_test5 (void)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
int argc;
|
int argc;
|
||||||
char *old_locale;
|
char *old_locale, *current_locale;
|
||||||
|
const char *locale = "de_DE";
|
||||||
GOptionEntry entries [] =
|
GOptionEntry entries [] =
|
||||||
{ { "test", 0, 0, G_OPTION_ARG_DOUBLE, &arg_test5_double, NULL, NULL },
|
{ { "test", 0, 0, G_OPTION_ARG_DOUBLE, &arg_test5_double, NULL, NULL },
|
||||||
{ NULL } };
|
{ NULL } };
|
||||||
@ -382,7 +384,14 @@ arg_test5 (void)
|
|||||||
argv = split_string ("program --test 20,0 --test 30,03", &argc);
|
argv = split_string ("program --test 20,0 --test 30,03", &argc);
|
||||||
|
|
||||||
/* set it to some locale that uses commas instead of decimal points */
|
/* set it to some locale that uses commas instead of decimal points */
|
||||||
old_locale = g_strdup (setlocale(LC_NUMERIC, "de"));
|
|
||||||
|
old_locale = g_strdup (setlocale (LC_NUMERIC, locale));
|
||||||
|
current_locale = setlocale (LC_NUMERIC, NULL);
|
||||||
|
if (strcmp (current_locale, locale) != 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Cannot set locale to %s, skipping\n", locale);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
retval = g_option_context_parse (context, &argc, &argv, &error);
|
retval = g_option_context_parse (context, &argc, &argv, &error);
|
||||||
g_assert (retval);
|
g_assert (retval);
|
||||||
@ -390,6 +399,7 @@ arg_test5 (void)
|
|||||||
/* Last arg specified is the one that should be stored */
|
/* Last arg specified is the one that should be stored */
|
||||||
g_assert (arg_test5_double == 30.03);
|
g_assert (arg_test5_double == 30.03);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
setlocale (LC_NUMERIC, old_locale);
|
setlocale (LC_NUMERIC, old_locale);
|
||||||
g_free (old_locale);
|
g_free (old_locale);
|
||||||
|
|
||||||
@ -907,6 +917,7 @@ empty_test1 (void)
|
|||||||
GOptionEntry entries [] =
|
GOptionEntry entries [] =
|
||||||
{ { NULL } };
|
{ { NULL } };
|
||||||
|
|
||||||
|
g_set_prgname (NULL);
|
||||||
context = g_option_context_new (NULL);
|
context = g_option_context_new (NULL);
|
||||||
|
|
||||||
g_option_context_add_main_entries (context, entries, NULL);
|
g_option_context_add_main_entries (context, entries, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user