formatClientAssignment

Constructs statement lines for each changed field of an IRCClient, including instantiating a fresh one.

version(AssertGeneration)
private pure @safe
void
formatClientAssignment
(
Sink
)
(
auto ref Sink sink
,,)
if (
isOutputRange!(Sink, char[])
)

Parameters

sink Sink

Output buffer to write to.

client IRCClient

IRCClient to simulate the assignment of.

server IRCServer

IRCServer to simulate the assignment of.

Examples

IRCClient client;
IRCServer server;
Appender!(char[]) sink;

sink.formatClientAssignment(client, server);
    import std.array : Appender;

    Appender!(char[]) sink;
    sink.reserve(128);

    IRCClient client;
    IRCServer server;

    with (client)
    {
        nickname = "NICKNAME";
        user = "UUUUUSER";
        server.address = "something.freenode.net";
        server.port = 6667;
        server.daemon = IRCServer.Daemon.unreal;
        server.aModes = "eIbq";
    }

    sink.formatClientAssignment(client, server);

    assert(sink.data ==
`IRCParser parser;

with (parser)
{
    client.nickname = "NICKNAME";
    client.user = "UUUUUSER";
    server.address = "something.freenode.net";
    server.port = 6667;
    server.daemon = IRCServer.Daemon.unreal;
    server.aModes = "eIbq";
}`, '\n' ~ sink.data);