aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-05-04 18:03:03 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-05-04 18:17:08 +0200
commit7cb1e1ee0136b3e37b1b234342c64f2fc181a6b2 (patch)
tree1dd13c777e000626f40595ad25246749760feac3 /tests
parentff108521589639e63caa5a589bb8ee80dea1eac6 (diff)
test557: set a known good numeric locale
Windows does not allow setting the locale with environment variables (as the test attempted to do), so the test failed when run with a user locale that has a comma as radixchar. Changed the test to call setlocale() explicitly to ensure that a known working locale is set even on Windows.
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test5574
-rw-r--r--tests/libtest/lib557.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/tests/data/test557 b/tests/data/test557
index 123bbeade..ad9350f6e 100644
--- a/tests/data/test557
+++ b/tests/data/test557
@@ -15,10 +15,6 @@ unittest
<server>
none
</server>
-<setenv>
-LC_ALL=
-LC_NUMERIC=C
-</setenv>
# tool is what to use instead of 'curl'
<tool>
lib557
diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c
index 68fdfa2b1..ca3118aec 100644
--- a/tests/libtest/lib557.c
+++ b/tests/libtest/lib557.c
@@ -26,8 +26,12 @@
*/
#include "test.h"
-#include "memdebug.h"
+#ifdef HAVE_LOCALE_H
+# include <locale.h> /* for setlocale() */
+#endif
+
+#include "memdebug.h"
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
# define MPRNT_SUFFIX_CURL_OFF_T LL
@@ -1656,6 +1660,14 @@ int test(char *URL)
int errors = 0;
(void)URL; /* not used */
+#ifdef HAVE_SETLOCALE
+ /*
+ * The test makes assumptions about the numeric locale (specifically,
+ * RADIXCHAR) so set it to a known working (and portable) one.
+ */
+ setlocale(LC_NUMERIC, "C");
+#endif
+
errors += test_weird_arguments();
errors += test_unsigned_short_formatting();