aboutsummaryrefslogtreecommitdiff
path: root/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp')
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index 79f972b2fee3..288eb325252b 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// void resize(size_type n, charT c);
@@ -23,17 +22,26 @@ template <class S>
void
test(S s, typename S::size_type n, typename S::value_type c, S expected)
{
- try
+ if (n <= s.max_size())
{
s.resize(n, c);
LIBCPP_ASSERT(s.__invariants());
- assert(n <= s.max_size());
assert(s == expected);
}
- catch (std::length_error&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(n > s.max_size());
+ try
+ {
+ s.resize(n, c);
+ assert(false);
+ }
+ catch (std::length_error&)
+ {
+ assert(n > s.max_size());
+ }
}
+#endif
}
int main()