mirror of
https://github.com/boostorg/utility.git
synced 2025-10-17 18:55:20 +02:00
Make string_{view|ref} remove_prefix and remove_suffix throw on invalid lengths. Addresses issue #73
This commit is contained in:
@@ -74,6 +74,13 @@ void test_remove ( const std::string &str ) {
|
||||
}
|
||||
}
|
||||
|
||||
ref = str;
|
||||
try {
|
||||
ref.remove_prefix(ref.size() + 1);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch ( const std::out_of_range &) {}
|
||||
|
||||
for ( size_t i = 1; i < sz; ++ i ) {
|
||||
work = str;
|
||||
ref = str;
|
||||
@@ -83,6 +90,13 @@ void test_remove ( const std::string &str ) {
|
||||
ref.remove_suffix (i);
|
||||
}
|
||||
}
|
||||
|
||||
ref = str;
|
||||
try {
|
||||
ref.remove_suffix(ref.size() + 1);
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch ( const std::out_of_range &) {}
|
||||
}
|
||||
|
||||
const char *test_strings [] = {
|
||||
|
Reference in New Issue
Block a user