summaryrefslogtreecommitdiff
path: root/tests/test-localename.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-03-27 21:41:36 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-03-27 21:41:36 +0200
commit6b73edd95d603e27d55d4905134ac1327d426534 (patch)
treee0b9334e2637f17696c796ac13b2c39294bf9233 /tests/test-localename.c
parent0250cb64565a7d5238bbc751225d4b0236ef8316 (diff)
New upstream version 0.9.7upstream/0.9.7
Diffstat (limited to 'tests/test-localename.c')
-rw-r--r--tests/test-localename.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/tests/test-localename.c b/tests/test-localename.c
index b5dd742f..be8fcaff 100644
--- a/tests/test-localename.c
+++ b/tests/test-localename.c
@@ -1,5 +1,5 @@
/* Test of gl_locale_name function and its variants.
- Copyright (C) 2007-2015 Free Software Foundation, Inc.
+ Copyright (C) 2007-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -183,6 +183,8 @@ test_locale_name (void)
ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES");
ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
@@ -194,11 +196,13 @@ test_locale_name (void)
for (i = 0; i < SIZEOF (categories); i++)
{
int category_mask = categories[i].mask;
- locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
- if (locale != NULL)
+ locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+ if (loc != NULL)
{
- locale = newlocale (category_mask, "de_DE.UTF-8", locale);
- if (locale != NULL)
+ locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+ if (locale == NULL)
+ freelocale (loc);
+ else
{
unsigned int j;
@@ -212,6 +216,8 @@ test_locale_name (void)
else
ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
}
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
}
@@ -245,6 +251,8 @@ test_locale_name_thread (void)
ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
name = gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES");
ASSERT (strcmp (name, "fr_FR.UTF-8") == 0);
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
@@ -256,11 +264,13 @@ test_locale_name_thread (void)
for (i = 0; i < SIZEOF (categories); i++)
{
int category_mask = categories[i].mask;
- locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
- if (locale != NULL)
+ locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+ if (loc != NULL)
{
- locale = newlocale (category_mask, "de_DE.UTF-8", locale);
- if (locale != NULL)
+ locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+ if (locale == NULL)
+ freelocale (loc);
+ else
{
unsigned int j;
@@ -275,6 +285,8 @@ test_locale_name_thread (void)
else
ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
}
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
}
@@ -444,6 +456,7 @@ test_locale_name_thread (void)
ASSERT (strcmp (unsaved_names[j][i], name) == 0);
}
uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
/* Verify the unsaved_names are still valid. */
@@ -453,7 +466,10 @@ test_locale_name_thread (void)
unsigned int i;
for (i = 0; i < SIZEOF (categories); i++)
- ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+ {
+ ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+ free (saved_names[j][i]);
+ }
}
}
#else
@@ -590,6 +606,8 @@ test_locale_name_posix (void)
uselocale (locale);
name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES");
ASSERT (strcmp (name, "C") == 0);
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
#endif
@@ -702,6 +720,8 @@ test_locale_name_environ (void)
uselocale (locale);
name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES");
ASSERT (strcmp (name, "C") == 0);
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
#endif
@@ -729,6 +749,8 @@ test_locale_name_default (void)
{
uselocale (locale);
ASSERT (strcmp (gl_locale_name_default (), name) == 0);
+ uselocale (LC_GLOBAL_LOCALE);
+ freelocale (locale);
}
}
#endif