From eb8c28c71192c86c88574d16ccb079ba2c57cc29 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 9 Feb 2018 20:05:54 +0300 Subject: [PATCH] Better locale changing in test. GitOrigin-RevId: 10ea1d33eaadcda638b9f03204523118d7c85e53 --- tdutils/test/misc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tdutils/test/misc.cpp b/tdutils/test/misc.cpp index 4d6c05314..a5511d0eb 100644 --- a/tdutils/test/misc.cpp +++ b/tdutils/test/misc.cpp @@ -20,6 +20,7 @@ #include #include #include +#include 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(); }