Revert "Revert "Update system_error tests for more platforms.""
authorDan Albert <danalbert@google.com>
Fri, 13 Mar 2020 19:01:59 +0000 (12:01 -0700)
committerDan Albert <danalbert@google.com>
Fri, 13 Mar 2020 19:11:27 +0000 (12:11 -0700)
This time using old fashioned starts_with.

This reverts commit d4a8c3f2511f12e21e3c9adf58e162db25538c16.

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

index f044273..e0e65a6 100644 (file)
@@ -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);
 }
 
index 8374c87..5165fb3 100644 (file)
@@ -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);
 }