Missed a test with exceptions disabled earlier. Oops.

llvm-svn: 286883
This commit is contained in:
Marshall Clow 2016-11-14 20:38:43 +00:00
parent 3d38c38826
commit 209fc55b01
1 changed files with 14 additions and 4 deletions

View File

@ -31,7 +31,7 @@ test(SV sv, unsigned pos, unsigned n)
{ {
typedef typename S::traits_type T; typedef typename S::traits_type T;
typedef typename S::allocator_type A; typedef typename S::allocator_type A;
try if (pos <= sv.size())
{ {
S s2(sv, pos, n); S s2(sv, pos, n);
LIBCPP_ASSERT(s2.__invariants()); LIBCPP_ASSERT(s2.__invariants());
@ -42,10 +42,20 @@ test(SV sv, unsigned pos, unsigned n)
assert(s2.get_allocator() == A()); assert(s2.get_allocator() == A());
assert(s2.capacity() >= s2.size()); assert(s2.capacity() >= s2.size());
} }
catch (std::out_of_range&) #ifndef TEST_HAS_NO_EXCEPTIONS
else
{ {
assert(pos > sv.size()); try
{
S s2(sv, pos, n);
assert(false);
}
catch (std::out_of_range&)
{
assert(pos > sv.size());
}
} }
#endif
} }
template <class S, class SV> template <class S, class SV>
@ -162,5 +172,5 @@ int main()
S s7(s.data(), 2); // calls ctor(const char *, len) S s7(s.data(), 2); // calls ctor(const char *, len)
assert(s7 == "AB"); assert(s7 == "AB");
} }
} }