[libcxx-commits] [libcxx] adefcc8 - Revert "Revert "Update system_error tests for more platforms.""

Dan Albert via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 13 12:13:10 PDT 2020


Author: Dan Albert
Date: 2020-03-13T12:11:27-07:00
New Revision: adefcc8ab5be0b4d2e25356241987d923137ebb0

URL: https://github.com/llvm/llvm-project/commit/adefcc8ab5be0b4d2e25356241987d923137ebb0
DIFF: https://github.com/llvm/llvm-project/commit/adefcc8ab5be0b4d2e25356241987d923137ebb0.diff

LOG: Revert "Revert "Update system_error tests for more platforms.""

This time using old fashioned starts_with.

This reverts commit d4a8c3f2511f12e21e3c9adf58e162db25538c16.

Added: 
    

Modified: 
    libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
    libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index f04427381cbb..e0e65a6d72eb 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -31,7 +31,8 @@ void test_message_for_bad_value() {
     errno = E2BIG; // something that message will never generate
     const std::error_category& e_cat1 = std::generic_category();
     const std::string msg = e_cat1.message(-1);
-    LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+    // Exact message format varies by platform.
+    LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
     assert(errno == E2BIG);
 }
 

diff  --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index 8374c8766b2e..5165fb3514fa 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -31,7 +31,8 @@ void test_message_for_bad_value() {
     errno = E2BIG; // something that message will never generate
     const std::error_category& e_cat1 = std::system_category();
     const std::string msg = e_cat1.message(-1);
-    LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+    // Exact message format varies by platform.
+    LIBCPP_ASSERT(msg.rfind("Unknown error", 0) == 0);
     assert(errno == E2BIG);
 }
 


        


More information about the libcxx-commits mailing list