mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Protect std::ios tests under libcpp-no-exceptions
Skip tests that expect an exception be thrown. Also add some missing asserts in the original test. Differential Revision: https://reviews.llvm.org/D26512 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286823 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// XFAIL: libcpp-no-exceptions
|
||||
// <ios>
|
||||
|
||||
// template <class charT, class traits> class basic_ios
|
||||
@@ -18,6 +17,8 @@
|
||||
#include <streambuf>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct testbuf
|
||||
: public std::streambuf
|
||||
{
|
||||
@@ -35,16 +36,20 @@ int main()
|
||||
testbuf sb1;
|
||||
testbuf sb2;
|
||||
testios ios(&sb1);
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
ios.setstate(std::ios::badbit);
|
||||
ios.exceptions(std::ios::badbit);
|
||||
assert(false);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
ios.set_rdbuf(&sb2);
|
||||
assert(ios.rdbuf() == &sb2);
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
ios.setstate(std::ios::badbit);
|
||||
@@ -53,6 +58,7 @@ int main()
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
ios.set_rdbuf(0);
|
||||
assert(ios.rdbuf() == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user