summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-01-13 21:12:10 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2019-05-19 11:12:13 +0100
commit099029853b4ffdd3bdafe4fae82a621665ada248 (patch)
treeef34a7ef099a512f127a278ad9340152d42eb0cd
parentfe1fb36e57a35c73740fc7ff2286fd0b7b3c0a20 (diff)
downloadlibgit2-099029853b4ffdd3bdafe4fae82a621665ada248.tar.gz
core::posix: skip some locale tests on win32
-rw-r--r--tests/core/posix.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/core/posix.c b/tests/core/posix.c
index a02c8b351..2b6007784 100644
--- a/tests/core/posix.c
+++ b/tests/core/posix.c
@@ -15,11 +15,15 @@
#include "posix.h"
#include "userdiff.h"
+#if LC_ALL > 0
static const char *old_locales[LC_ALL];
+#endif
void test_core_posix__initialize(void)
{
+#if LC_ALL > 0
memset(&old_locales, 0, sizeof(old_locales));
+#endif
#ifdef GIT_WIN32
/* on win32, the WSA context needs to be initialized
@@ -33,13 +37,6 @@ void test_core_posix__initialize(void)
void test_core_posix__cleanup(void)
{
- int i;
-
- for (i = 0; i < LC_ALL; i++) {
- if (old_locales[i])
- setlocale(i, old_locales[i]);
- }
-
p_unlink("fallocate_test");
}
@@ -165,7 +162,9 @@ void test_core_posix__utimes(void)
static void try_set_locale(int category)
{
+#if LC_ALL > 0
old_locales[category] = setlocale(category, NULL);
+#endif
if (!setlocale(category, "UTF-8") &&
!setlocale(category, "c.utf8") &&
@@ -191,6 +190,10 @@ void test_core_posix__p_regcomp_ignores_global_locale_collate(void)
{
p_regex_t preg;
+#ifdef GIT_WIN32
+ cl_skip();
+#endif
+
try_set_locale(LC_COLLATE);
cl_assert(!p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED));
@@ -202,6 +205,10 @@ void test_core_posix__p_regcomp_matches_digits_with_locale(void)
p_regex_t preg;
char c, str[2];
+#ifdef GIT_WIN32
+ cl_skip();
+#endif
+
try_set_locale(LC_COLLATE);
try_set_locale(LC_CTYPE);
@@ -221,6 +228,10 @@ void test_core_posix__p_regcomp_matches_alphabet_with_locale(void)
p_regex_t preg;
char c, str[2];
+#ifdef GIT_WIN32
+ cl_skip();
+#endif
+
try_set_locale(LC_COLLATE);
try_set_locale(LC_CTYPE);