summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/strings/basic.string/string.cons
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-11-14 20:38:43 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-11-14 20:38:43 +0000
commit209fc55b01e453a479d415f8242bb4c462c5e137 (patch)
tree09d87936c64f4e2afa170ca8e335fff6a12997c1 /libcxx/test/std/strings/basic.string/string.cons
parent3d38c38826299cbbfd480533eac7ef78ed5340a7 (diff)
downloadbcm5719-llvm-209fc55b01e453a479d415f8242bb4c462c5e137.tar.gz
bcm5719-llvm-209fc55b01e453a479d415f8242bb4c462c5e137.zip
Missed a test with exceptions disabled earlier. Oops.
llvm-svn: 286883
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.cons')
-rw-r--r--libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
index edc0f124f69..144a1ab1f58 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
@@ -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");
- }
+ }
}
OpenPOWER on IntegriCloud