[libcxx] r286883 - Missed a test with exceptions disabled earlier. Oops.
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 14 12:38:44 PST 2016
Author: marshall
Date: Mon Nov 14 14:38:43 2016
New Revision: 286883
URL: http://llvm.org/viewvc/llvm-project?rev=286883&view=rev
Log:
Missed a test with exceptions disabled earlier. Oops.
Modified:
libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp?rev=286883&r1=286882&r2=286883&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Mon Nov 14 14:38:43 2016
@@ -31,7 +31,7 @@ test(SV sv, unsigned pos, unsigned n)
{
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
- try
+ if (pos <= sv.size())
{
S s2(sv, pos, n);
LIBCPP_ASSERT(s2.__invariants());
@@ -42,10 +42,20 @@ test(SV sv, unsigned pos, unsigned n)
assert(s2.get_allocator() == A());
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>
@@ -162,5 +172,5 @@ int main()
S s7(s.data(), 2); // calls ctor(const char *, len)
assert(s7 == "AB");
- }
+ }
}
More information about the cfe-commits
mailing list