[PATCH] D26608: Protect std::string tests under libcpp-no-exceptions
Roger Ferrer Ibanez via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 24 03:25:10 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287865: Protect std::string tests under libcpp-no-exceptions (authored by rogfer01).
Changed prior to commit:
https://reviews.llvm.org/D26608?vs=77805&id=79206#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26608
Files:
libcxx/trunk/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
Index: libcxx/trunk/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
===================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ libcxx/trunk/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string substr(size_type pos = 0, size_type n = npos) const;
@@ -24,19 +23,27 @@
void
test(const S& s, typename S::size_type pos, typename S::size_type n)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#else
+ if (pos <= s.size())
+#endif
{
S str = s.substr(pos, n);
LIBCPP_ASSERT(str.__invariants());
+#ifndef TEST_HAS_NO_EXCEPTIONS
assert(pos <= s.size());
+#endif
typename S::size_type rlen = std::min(n, s.size() - pos);
assert(str.size() == rlen);
assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (std::out_of_range&)
{
assert(pos > s.size());
}
+#endif
}
int main()
Index: libcxx/trunk/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
===================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
+++ libcxx/trunk/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26608.79206.patch
Type: text/x-patch
Size: 2254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161124/a3722731/attachment.bin>
More information about the cfe-commits
mailing list