[libcxx] r288165 - Protect std::array tests under noexceptions

Roger Ferrer Ibanez via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 09:10:29 PST 2016


Author: rogfer01
Date: Tue Nov 29 11:10:29 2016
New Revision: 288165

URL: http://llvm.org/viewvc/llvm-project?rev=288165&view=rev
Log:
Protect std::array tests under noexceptions

Skip tests that expect exceptions be thrown. Also add missing asserts.

Differential Revision: https://reviews.llvm.org/D27095


Modified:
    libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp

Modified: libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp?rev=288165&r1=288164&r2=288165&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp Tue Nov 29 11:10:29 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <array>
 
 // reference operator[] (size_type)
@@ -40,8 +39,14 @@ int main()
         r2 = 7.5;
         assert(c.back() == 7.5);
 
-        try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+        try
+        {
+            (void) c.at(3);
+            assert(false);
+        }
         catch (const std::out_of_range &) {}
+#endif
     }
     {
         typedef double T;
@@ -53,8 +58,14 @@ int main()
         C::const_reference r2 = c.at(2);
         assert(r2 == 3.5);
 
-        try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+        try
+        {
+            (void) c.at(3);
+            assert(false);
+        }
         catch (const std::out_of_range &) {}
+#endif
     }
 
 #if TEST_STD_VER > 11




More information about the cfe-commits mailing list