1
0
forked from Alepha/Alepha

Make it possible to use arbitrary code in making delimited lists.

This commit is contained in:
2024-04-04 15:41:27 -04:00
parent 58327d5afd
commit a6467772f4
3 changed files with 48 additions and 9 deletions

View File

@ -7,6 +7,8 @@ static_assert( __cplusplus > 2020'99 );
#include <Alepha/Utility/evaluation_helpers.h>
#include <Alepha/IOStreams/delimiters.h>
static auto init= Alepha::Utility::enroll <=[]
{
using namespace Alepha::Testing::literals;
@ -32,4 +34,32 @@ static auto init= Alepha::Utility::enroll <=[]
{
{ "Simple", { { "Alpha", "Bravo", "Charlie", "Delta", "Echo" } }, "Alpha, Bravo, Charlie, Delta, Echo" },
};
"Simple Comma Testing using delim function"_test <=TableTest
<
[]( std::vector< std::string > names )
{
std::ostringstream oss;
oss << setDelimiter( Alepha::IOStreams::fieldDelimiter, ", " );
oss << Alepha::StartDelimitedList
{
[]( std::ostream &os )
{
os << Alepha::IOStreams::fieldDelimiter;
}
};
for( const auto &name: names )
{
oss << Alepha::NextItem << name;
}
return oss.str();
}
>
::Cases
{
{ "Simple", { { "Alpha", "Bravo", "Charlie", "Delta", "Echo" } }, "Alpha, Bravo, Charlie, Delta, Echo" },
};
};