Author: ericwf Date: Mon May 30 20:51:34 2016 New Revision: 271248 URL: http://llvm.org/viewvc/llvm-project?rev=271248&view=rev Log: Add tests that got missed in r271247.
Added: libcxx/trunk/test/libcxx/thread/futures/futures.promise/ libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Added: libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp?rev=271248&view=auto ============================================================================== --- libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp (added) +++ libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp Mon May 30 20:51:34 2016 @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// + +// UNSUPPORTED: libcpp-no-exceptions +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 + +// <future> + +// class promise<R> + +// void set_exception(exception_ptr p); +// Test that a null exception_ptr is diagnosed. + +#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) + +#define _LIBCPP_DEBUG 0 +#include <future> +#include <exception> +#include <cstdlib> +#include <cassert> + + +int main() +{ + { + typedef int T; + std::promise<T> p; + try { + p.set_exception(std::exception_ptr()); + assert(false); + } catch (int const& value) { + assert(value == 42); + } + } + { + typedef int& T; + std::promise<T> p; + try { + p.set_exception(std::exception_ptr()); + assert(false); + } catch (int const& value) { + assert(value == 42); + } + } +} Added: libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp?rev=271248&view=auto ============================================================================== --- libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp (added) +++ libcxx/trunk/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Mon May 30 20:51:34 2016 @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// +// + +// UNSUPPORTED: libcpp-no-exceptions +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 + +// <future> + +// class promise<R> + +// void set_exception_on_thread_exit(exception_ptr p); +// Test that a null exception_ptr is diagnosed. + +#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42) + +#define _LIBCPP_DEBUG 0 +#include <future> +#include <exception> +#include <cstdlib> +#include <cassert> + + +int main() +{ + { + typedef int T; + std::promise<T> p; + try { + p.set_exception_at_thread_exit(std::exception_ptr()); + assert(false); + } catch (int const& value) { + assert(value == 42); + } + } + { + typedef int& T; + std::promise<T> p; + try { + p.set_exception_at_thread_exit(std::exception_ptr()); + assert(false); + } catch (int const& value) { + assert(value == 42); + } + } +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits