Another fix to appease the no-exception bots.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276272 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,22 +22,26 @@
|
||||
|
||||
template<typename CharT>
|
||||
void test1(std::basic_string_view<CharT> sv, size_t n, size_t pos) {
|
||||
std::basic_string_view<CharT> sv1;
|
||||
#ifdef TEST_HAS_NO_EXCEPTIONS
|
||||
if (pos <= sv.size())
|
||||
assert (sign( sv1.compare(pos1, n1, sv2)) == sign(expected));
|
||||
if (pos > sv.size())
|
||||
return ; // would throw if exceptions were enabled
|
||||
sv1 = sv.substr(pos, n);
|
||||
#else
|
||||
try {
|
||||
std::basic_string_view<CharT> sv1 = sv.substr(pos, n);
|
||||
sv1 = sv.substr(pos, n);
|
||||
assert(pos <= sv.size());
|
||||
}
|
||||
catch (const std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
return ;
|
||||
}
|
||||
#endif
|
||||
const size_t rlen = std::min(n, sv.size() - pos);
|
||||
assert (sv1.size() == rlen);
|
||||
for (size_t i = 0; i <= rlen; ++i)
|
||||
assert(sv[pos+i] == sv1[i]);
|
||||
}
|
||||
catch (const std::out_of_range&) {
|
||||
assert(pos > sv.size());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<typename CharT>
|
||||
|
||||
Reference in New Issue
Block a user