mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 18:38:30 +08:00
Protect std::string tests under libcpp-no-exceptions
Skip tests that expect an exception be thrown and/or disable unreachable catch handlers. Differential Revision: https://reviews.llvm.org/D26608 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287865 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// XFAIL: libcpp-no-exceptions
|
||||
// <string>
|
||||
|
||||
// size_type capacity() const;
|
||||
@@ -18,21 +17,27 @@
|
||||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class S>
|
||||
void
|
||||
test(S s)
|
||||
{
|
||||
S::allocator_type::throw_after = 0;
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
try
|
||||
#endif
|
||||
{
|
||||
while (s.size() < s.capacity())
|
||||
s.push_back(typename S::value_type());
|
||||
assert(s.size() == s.capacity());
|
||||
}
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
catch (...)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
S::allocator_type::throw_after = INT_MAX;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user