Skip to content

Commit 6f0c647

Browse files
committed
Fixing several locale tests to use a locale more widely avaliable on machines.
1 parent 1ff94cb commit 6f0c647

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

Release/tests/functional/http/client/building_request_tests.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,13 @@ TEST_FIXTURE(uri_address, set_body_with_charset)
250250

251251
TEST_FIXTURE(uri_address, set_content_length_locale, "Ignore:Android", "Locale unsupported on Android")
252252
{
253-
tests::common::utilities::locale_guard loc(std::locale("en-us"));
253+
#ifdef _WIN32
254+
std::string changedLocale("fr-FR");
255+
#else
256+
std::string changedLocale("fr_FR.utf8");
257+
#endif
258+
259+
tests::common::utilities::locale_guard loc(std::locale(changedLocale.c_str()));
254260

255261
http_request req(methods::PUT);
256262
req.headers().set_content_length(1000);
@@ -270,7 +276,12 @@ TEST_FIXTURE(uri_address, set_port_locale, "Ignore:Android", "Locale unsupported
270276
});
271277

272278
{
273-
tests::common::utilities::locale_guard loc(std::locale("en-us"));
279+
#ifdef _WIN32
280+
std::string changedLocale("fr-FR");
281+
#else
282+
std::string changedLocale("fr_FR.utf8");
283+
#endif
284+
tests::common::utilities::locale_guard loc(std::locale(changedLocale.c_str()));
274285
http_request msg(methods::PUT);
275286
msg.set_body(data);
276287
http_asserts::assert_response_equals(client.request(msg).get(), status_codes::OK);

Release/tests/functional/json/json_numbers_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ TEST(parsing_doubles_setlocale, "Ignore:Android", "Locale not supported on Andro
195195
#endif
196196
setlocale(LC_ALL, changedLocale.c_str());
197197

198-
test_double(1.91563, U("1.91563"));
199-
test_double(2.0e93, U("2.0e93"));
198+
test_double(1.91563);
199+
test_double(2.0e93);
200200
setlocale(LC_ALL, "C");
201201
}
202202

Release/tests/functional/uri/uri_builder_tests.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,13 @@ TEST(to_string_invalid_uri)
458458

459459
TEST(append_query_locale, "Ignore:Android", "Locale unsupported on Android")
460460
{
461-
tests::common::utilities::locale_guard loc(std::locale("en-us"));
461+
#ifdef _WIN32
462+
std::string changedLocale("fr-FR");
463+
#else
464+
std::string changedLocale("fr_FR.utf8");
465+
#endif
466+
467+
tests::common::utilities::locale_guard loc(std::locale(changedLocale.c_str()));
462468

463469
uri_builder builder;
464470
auto const &key = U("key1000");

Release/tests/functional/utils/strings.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,31 @@ TEST(latin1_to_utf16)
7171

7272
TEST(print_string_locale, "Ignore:Android", "Locale unsupported on Android")
7373
{
74-
tests::common::utilities::locale_guard loc(std::locale("en-us"));
74+
#ifdef _WIN32
75+
std::string changedLocale("fr-FR");
76+
#else
77+
std::string changedLocale("fr_FR.utf8");
78+
#endif
79+
80+
tests::common::utilities::locale_guard loc(std::locale(changedLocale.c_str()));
7581

7682
VERIFY_ARE_EQUAL(_XPLATSTR("1,000"), utility::conversions::print_string(1000));
7783
VERIFY_ARE_EQUAL(_XPLATSTR("1000"), utility::conversions::print_string(1000, std::locale::classic()));
7884
}
7985

8086
TEST(scan_string_locale, "Ignore:Android", "Locale unsupported on Android")
8187
{
88+
#ifdef _WIN32
89+
std::string changedLocale("fr-FR");
90+
#else
91+
std::string changedLocale("fr_FR.utf8");
92+
#endif
93+
8294
VERIFY_ARE_EQUAL(_XPLATSTR("1000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1000"))));
8395
VERIFY_ARE_EQUAL(_XPLATSTR("1,000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1,000"))));
8496

85-
VERIFY_ARE_EQUAL(_XPLATSTR("1000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1000")), std::locale("en-us")));
86-
VERIFY_ARE_EQUAL(_XPLATSTR("1,000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1,000")), std::locale("en-us")));
97+
VERIFY_ARE_EQUAL(_XPLATSTR("1000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1000")), std::locale(changedLocale.c_str())));
98+
VERIFY_ARE_EQUAL(_XPLATSTR("1,000"), utility::conversions::scan_string<utility::string_t>(utility::string_t(_XPLATSTR("1,000")), std::locale(changedLocale.c_str())));
8799

88100
{
89101
tests::common::utilities::locale_guard loc(std::locale("en-us"));

0 commit comments

Comments
 (0)