Better locale changing in test.

GitOrigin-RevId: 10ea1d33eaadcda638b9f03204523118d7c85e53
This commit is contained in:
levlam 2018-02-09 20:05:54 +03:00
parent 6277672f3e
commit eb8c28c711

View File

@ -20,6 +20,7 @@
#include <atomic>
#include <clocale>
#include <limits>
#include <locale>
using namespace td;
@ -216,8 +217,10 @@ static void test_to_double() {
TEST(Misc, to_double) {
test_to_double();
std::setlocale(LC_ALL, "fr-FR");
std::string locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "C" : "fr-FR");
std::locale new_locale(locale_name);
std::locale::global(new_locale);
test_to_double();
std::setlocale(LC_ALL, "C");
std::locale::global(std::locale::classic());
test_to_double();
}