[libcxx] r272642 - Update errcat.objects tests so they test the bug fixed in r272640.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 23:37:37 PDT 2016


Author: ericwf
Date: Tue Jun 14 01:37:36 2016
New Revision: 272642

URL: http://llvm.org/viewvc/llvm-project?rev=272642&view=rev
Log:
Update errcat.objects tests so they test the bug fixed in r272640.

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

Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp?rev=272642&r1=272641&r2=272642&view=diff
==============================================================================
--- libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp (original)
+++ libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp Tue Jun 14 01:37:36 2016
@@ -18,10 +18,13 @@
 #include <string>
 #include <cerrno>
 
-void test_message_leaves_errno_unchanged() {
+#include "test_macros.h"
+
+void test_message_for_bad_value() {
     errno = E2BIG; // something that message will never generate
     const std::error_category& e_cat1 = std::generic_category();
-    e_cat1.message(-1);
+    const std::string msg = e_cat1.message(-1);
+    LIBCPP_ASSERT(msg == "Unknown error -1");
     assert(errno == E2BIG);
 }
 
@@ -31,6 +34,6 @@ int main()
     std::string m1 = e_cat1.name();
     assert(m1 == "generic");
     {
-        test_message_leaves_errno_unchanged();
+        test_message_for_bad_value();
     }
 }

Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp?rev=272642&r1=272641&r2=272642&view=diff
==============================================================================
--- libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp (original)
+++ libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp Tue Jun 14 01:37:36 2016
@@ -18,11 +18,13 @@
 #include <string>
 #include <cerrno>
 
+#include "test_macros.h"
 
-void test_message_leaves_errno_unchanged() {
+void test_message_for_bad_value() {
     errno = E2BIG; // something that message will never generate
     const std::error_category& e_cat1 = std::system_category();
-    e_cat1.message(-1);
+    const std::string msg = e_cat1.message(-1);
+    LIBCPP_ASSERT(msg == "Unknown error -1");
     assert(errno == E2BIG);
 }
 
@@ -36,6 +38,6 @@ int main()
     assert(e_cond.value() == 5000);
     assert(e_cond.category() == std::system_category());
     {
-        test_message_leaves_errno_unchanged();
+        test_message_for_bad_value();
     }
 }




More information about the cfe-commits mailing list