summaryrefslogtreecommitdiffstats
path: root/libcxx/test/language.support/support.exception/propagation
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
committerEric Fiselier <eric@efcs.ca>2014-12-20 01:40:03 +0000
commit5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch)
treeafde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/language.support/support.exception/propagation
parentf11e8eab527fba316c64112f6e05de1a79693a3e (diff)
downloadbcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz
bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/language.support/support.exception/propagation')
-rw-r--r--libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp269
-rw-r--r--libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp34
-rw-r--r--libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp49
-rw-r--r--libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp57
4 files changed, 0 insertions, 409 deletions
diff --git a/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp b/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp
deleted file mode 100644
index 9ff0d6e2ce4..00000000000
--- a/libcxx/test/language.support/support.exception/propagation/current_exception.pass.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <exception>
-
-// exception_ptr current_exception();
-
-#include <exception>
-#include <cassert>
-
-struct A
-{
- static int constructed;
-
- A() {++constructed;}
- ~A() {--constructed;}
- A(const A&) {++constructed;}
-};
-
-int A::constructed = 0;
-
-int main()
-{
- {
- std::exception_ptr p = std::current_exception();
- assert(p == nullptr);
- }
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
- assert(A::constructed == 0);
- {
- std::exception_ptr p2;
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 1);
- assert(p != nullptr);
- p2 = std::current_exception();
- assert(A::constructed == 1);
- assert(p == p2);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- {
- std::exception_ptr p2;
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (A& a)
- {
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 1);
- assert(p != nullptr);
- p2 = std::current_exception();
- assert(A::constructed == 1);
- assert(p == p2);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- {
- std::exception_ptr p2;
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (A a)
- {
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 2);
- assert(p != nullptr);
- p2 = std::current_exception();
- assert(A::constructed == 2);
- assert(p == p2);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- assert(A::constructed == 1);
- throw;
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
- assert(A::constructed == 0);
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 1);
- assert(p != nullptr);
- throw;
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
- assert(A::constructed == 0);
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- assert(A::constructed == 1);
- throw;
- assert(false);
- }
- catch (...)
- {
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 1);
- assert(p != nullptr);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
- assert(A::constructed == 0);
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- assert(A::constructed == 1);
- throw;
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- }
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 1);
- assert(p != nullptr);
- }
- assert(A::constructed == 0);
- }
- assert(A::constructed == 0);
- {
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- assert(A::constructed == 1);
- throw;
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- }
- assert(A::constructed == 1);
- }
- std::exception_ptr p = std::current_exception();
- assert(A::constructed == 0);
- assert(p == nullptr);
- }
- assert(A::constructed == 0);
- {
- std::exception_ptr p;
- try
- {
- assert(A::constructed == 0);
- throw A();
- assert(false);
- }
- catch (...)
- {
- assert(A::constructed == 1);
- try
- {
- assert(A::constructed == 1);
- throw;
- assert(false);
- }
- catch (...)
- {
- p = std::current_exception();
- assert(A::constructed == 1);
- }
- assert(A::constructed == 1);
- }
- assert(A::constructed == 1);
- assert(p != nullptr);
- }
- assert(A::constructed == 0);
-}
diff --git a/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp b/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp
deleted file mode 100644
index 3aa8dcf55bb..00000000000
--- a/libcxx/test/language.support/support.exception/propagation/exception_ptr.pass.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <exception>
-
-// typedef unspecified exception_ptr;
-
-// exception_ptr shall satisfy the requirements of NullablePointer.
-
-#include <exception>
-#include <cassert>
-
-int main()
-{
- std::exception_ptr p;
- assert(p == nullptr);
- std::exception_ptr p2 = p;
- assert(nullptr == p);
- assert(!p);
- assert(p2 == p);
- p2 = p;
- assert(p2 == p);
- assert(p2 == nullptr);
- std::exception_ptr p3 = nullptr;
- assert(p3 == nullptr);
- p3 = nullptr;
- assert(p3 == nullptr);
-}
diff --git a/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
deleted file mode 100644
index 89c9f85d381..00000000000
--- a/libcxx/test/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <exception>
-
-// template<class E> exception_ptr make_exception_ptr(E e);
-
-#include <exception>
-#include <cassert>
-
-struct A
-{
- static int constructed;
- int data_;
-
- A(int data = 0) : data_(data) {++constructed;}
- ~A() {--constructed;}
- A(const A& a) : data_(a.data_) {++constructed;}
-};
-
-int A::constructed = 0;
-
-int main()
-{
- {
- std::exception_ptr p = std::make_exception_ptr(A(5));
- try
- {
- std::rethrow_exception(p);
- assert(false);
- }
- catch (const A& a)
- {
- assert(A::constructed == 1);
- assert(p != nullptr);
- p = nullptr;
- assert(p == nullptr);
- assert(a.data_ == 5);
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
-}
diff --git a/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp
deleted file mode 100644
index e47a5989d41..00000000000
--- a/libcxx/test/language.support/support.exception/propagation/rethrow_exception.pass.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <exception>
-
-// void rethrow_exception [[noreturn]] (exception_ptr p);
-
-#include <exception>
-#include <cassert>
-
-struct A
-{
- static int constructed;
- int data_;
-
- A(int data = 0) : data_(data) {++constructed;}
- ~A() {--constructed;}
- A(const A& a) : data_(a.data_) {++constructed;}
-};
-
-int A::constructed = 0;
-
-int main()
-{
- {
- std::exception_ptr p;
- try
- {
- throw A(3);
- }
- catch (...)
- {
- p = std::current_exception();
- }
- try
- {
- std::rethrow_exception(p);
- assert(false);
- }
- catch (const A& a)
- {
- assert(A::constructed == 1);
- assert(p != nullptr);
- p = nullptr;
- assert(p == nullptr);
- assert(a.data_ == 3);
- assert(A::constructed == 1);
- }
- assert(A::constructed == 0);
- }
-}
OpenPOWER on IntegriCloud