Fix string_ref::find/rfind's handling of empty strings. Thanks to 'reluctantbugreporter' for the bug report

This commit is contained in:
Marshall Clow committed 2018-09-14 09:48:13 -07:00
1 parent 3d2a7f0c17
commit db05c11f50
3 files changed
+10

No files matched your search

+4
View File
@@ -93,6 +93,10 @@ void find ( const char *arg ) {
string_ref sr2;
const char *p;
// When we search for the empty string, we find it at position 0
BOOST_TEST ( sr1.find (sr2) == 0 );
BOOST_TEST ( sr1.rfind(sr2) == 0 );
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;
+4
View File
@@ -97,6 +97,10 @@ void find ( const char *arg ) {
string_view sr2;
const char *p;
// When we search for the empty string, we find it at position 0
BOOST_TEST ( sr1.find (sr2) == 0 );
BOOST_TEST ( sr1.rfind(sr2) == 0 );
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;