forked from Alepha/Alepha
Make it possible to use arbitrary code in making delimited lists.
This commit is contained in:
@ -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" },
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user