You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens-G (via GitHub)" <gi...@apache.org> on 2023/08/22 09:44:34 UTC

[GitHub] [thrift] Jens-G commented on a diff in pull request #2846: fix UnitTests Failed

Jens-G commented on code in PR #2846:
URL: https://github.com/apache/thrift/pull/2846#discussion_r1301371628


##########
lib/cpp/test/ToStringTest.cpp:
##########
@@ -46,23 +46,31 @@ BOOST_AUTO_TEST_CASE(base_types_to_string) {
 // Windows:
 #ifndef _WIN32
 BOOST_AUTO_TEST_CASE(locale_en_US_int_to_string) {
+  try {
 #ifdef _WIN32
-  std::locale::global(std::locale("en-US.UTF-8"));
+    std::locale::global(std::locale("en-US.UTF-8"));
 #else
-  std::locale::global(std::locale("en_US.UTF-8"));
+    std::locale::global(std::locale("en_US.UTF-8"));
 #endif
-  BOOST_CHECK_EQUAL(to_string(1000000), "1000000");
+    BOOST_CHECK_EQUAL(to_string(1000000), "1000000");
+  } catch (const std::runtime_error& e) {
+

Review Comment:
   Empty catch-all clauses are triggering some sort of "Are you sure?" reflex. Especially if the patch is called a fix. I would rather label it as "curing a symptom". Can we have at least a comment explaining why this is the optimal way to handle it?



##########
lib/cpp/test/ToStringTest.cpp:
##########
@@ -46,23 +46,31 @@ BOOST_AUTO_TEST_CASE(base_types_to_string) {
 // Windows:
 #ifndef _WIN32
 BOOST_AUTO_TEST_CASE(locale_en_US_int_to_string) {
+  try {
 #ifdef _WIN32
-  std::locale::global(std::locale("en-US.UTF-8"));
+    std::locale::global(std::locale("en-US.UTF-8"));
 #else
-  std::locale::global(std::locale("en_US.UTF-8"));
+    std::locale::global(std::locale("en_US.UTF-8"));
 #endif
-  BOOST_CHECK_EQUAL(to_string(1000000), "1000000");
+    BOOST_CHECK_EQUAL(to_string(1000000), "1000000");
+  } catch (const std::runtime_error& e) {
+
+  }
 }
 
 BOOST_AUTO_TEST_CASE(locale_de_DE_floating_point_to_string) {
+  try {
 #ifdef _WIN32
-  std::locale::global(std::locale("de-DE.UTF-8"));
+    std::locale::global(std::locale("de-DE.UTF-8"));
 #else
-  std::locale::global(std::locale("de_DE.UTF-8"));
+    std::locale::global(std::locale("de_DE.UTF-8"));
 #endif
-  BOOST_CHECK_EQUAL(to_string(1.5), "1.5");
-  BOOST_CHECK_EQUAL(to_string(1.5f), "1.5");
-  BOOST_CHECK_EQUAL(to_string(1.5L), "1.5");
+    BOOST_CHECK_EQUAL(to_string(1.5), "1.5");
+    BOOST_CHECK_EQUAL(to_string(1.5f), "1.5");
+    BOOST_CHECK_EQUAL(to_string(1.5L), "1.5");
+  } catch (const std::runtime_error& e) {
+    

Review Comment:
   Same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org