summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/optional/optional.object/optional.object.observe
diff options
context:
space:
mode:
authorRoger Ferrer Ibanez <roger.ferreribanez@arm.com>2016-11-07 08:23:59 +0000
committerRoger Ferrer Ibanez <roger.ferreribanez@arm.com>2016-11-07 08:23:59 +0000
commita5672e0c4bd11a29cff908d9d61652c00aa1b6e3 (patch)
treee6565b8e6390e3ff3788f9d6e826b8a9bdce0856 /libcxx/test/std/experimental/optional/optional.object/optional.object.observe
parent420537fad8a227095255d65890b6c7b992325a75 (diff)
downloadbcm5719-llvm-a5672e0c4bd11a29cff908d9d61652c00aa1b6e3.tar.gz
bcm5719-llvm-a5672e0c4bd11a29cff908d9d61652c00aa1b6e3.zip
Protect std::experimental::optional tests under libcpp-no-exceptions
In these tests there are some paths that explicitly throw, so use the TEST_THROW macro that was proposed for this and then skip the tests that may enter the throwing path. Differential Revision: https://reviews.llvm.org/D26142 llvm-svn: 286099
Diffstat (limited to 'libcxx/test/std/experimental/optional/optional.object/optional.object.observe')
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp5
-rw-r--r--libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
index b998f3067f4..c8f07111c23 100644
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// T& optional<T>::value();
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::bad_optional_access;
@@ -35,6 +36,7 @@ int main()
opt.emplace();
assert(opt.value().test() == 4);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<X> opt;
try
@@ -46,4 +48,5 @@ int main()
{
}
}
+#endif
}
diff --git a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
index a38b1f930c7..98ff16e4d13 100644
--- a/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/libcxx/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// constexpr const T& optional<T>::value() const;
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -40,6 +41,7 @@ int main()
const optional<X> opt(in_place);
assert(opt.value().test() == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
const optional<X> opt;
try
@@ -51,4 +53,5 @@ int main()
{
}
}
+#endif
}
OpenPOWER on IntegriCloud