mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
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.
This commit is contained in:
parent
ff10852158
commit
7cb1e1ee01
@ -15,10 +15,6 @@ unittest
|
|||||||
<server>
|
<server>
|
||||||
none
|
none
|
||||||
</server>
|
</server>
|
||||||
<setenv>
|
|
||||||
LC_ALL=
|
|
||||||
LC_NUMERIC=C
|
|
||||||
</setenv>
|
|
||||||
# tool is what to use instead of 'curl'
|
# tool is what to use instead of 'curl'
|
||||||
<tool>
|
<tool>
|
||||||
lib557
|
lib557
|
||||||
|
@ -26,8 +26,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "test.h"
|
#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)
|
#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
|
||||||
# define MPRNT_SUFFIX_CURL_OFF_T LL
|
# define MPRNT_SUFFIX_CURL_OFF_T LL
|
||||||
@ -1656,6 +1660,14 @@ int test(char *URL)
|
|||||||
int errors = 0;
|
int errors = 0;
|
||||||
(void)URL; /* not used */
|
(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_weird_arguments();
|
||||||
|
|
||||||
errors += test_unsigned_short_formatting();
|
errors += test_unsigned_short_formatting();
|
||||||
|
Loading…
Reference in New Issue
Block a user