1
0
forked from Alepha/Alepha

Fix bug in split, where the last item is discarded.

This commit is contained in:
2023-10-20 17:28:08 -04:00
parent 4e107ec0b1
commit 69aa923450
2 changed files with 8 additions and 0 deletions

View File

@ -219,6 +219,7 @@ namespace Alepha::Cavorite ::detail:: string_algorithms
rv.push_back( std::move( next ) ); rv.push_back( std::move( next ) );
next.clear(); next.clear();
} }
rv.push_back( std::move( next ) );
return rv; return rv;
} }
} }

View File

@ -47,4 +47,11 @@ static auto init= enroll <=[]
} }
catch( ... ) {} catch( ... ) {}
}; };
"Does the `split` function handle simple cases correctly?"_test <=TableTest< Alepha::split >::Cases
{
{ "Empty string", { "", ':' }, { "" } },
{ "Single token", { "item", ':' }, { "item" } },
{ "Two tokens", { "first:second", ':' }, { "first", "second" } },
};
}; };