Selftester

Helper struct to aid in testing plugins.

Members

Functions

awaitReply
void awaitReply()

Yields and waits for a response from the other bot.

expect
void expect(string tokenedExpected, string file, size_t line)

Yields and waits for a response from the other bot, then throws if the message doesn't match the passed string.

expectHead
void expectHead(string tokenedExpected, string file, size_t line)

Yields and waits for a response from the other bot, then throws if the message head does not match that of the passed string.

expectInBody
void expectInBody(string tokenedExpected, string file, size_t line)

Yields and waits for a response from the other bot, then throws if the message body does not contain the passed string.

expectTail
void expectTail(string tokenedExpected, string file, size_t line)

Yields and waits for a response from the other bot, then throws if the message tail does not match that of the passed string.

lastMessage
auto lastMessage(bool strip)

The last message received from the other bot, stripped of effects.

replaceTokens
auto replaceTokens(string line)

Replaces some tokens in a string with values from the test context.

require
void require(string tokenedExpected, string file, size_t line)

Checks that the last message received matches the passed string, and throws if it does not.

requireHead
void requireHead(string tokenedExpected, string file, size_t line)

Checks that the head of the last message received matches that of the passed string, and throws if it does not.

requireInBody
void requireInBody(string tokenedExpected, string file, size_t line)

Checks that the body of the last message received contains the passed string, and throws if it does not.

requireTail
void requireTail(string tokenedExpected, string file, size_t line)

Checks that the tail of the last message received contains the passed string, and throws if it does not.

requireTriggeredByTimer
void requireTriggeredByTimer(string file, size_t line)

Checks that the last fiber invocation was triggered by a timer.

send
void send(string tokenedLine)

Sends a message to the other test bot, prepending it with its nickname.

sendPlain
void sendPlain(string tokenedLine)

Sends a message to the other test bot as-is, without any prefixing.

sendPrefixed
void sendPrefixed(string tokenedLine)

Sends a message to the other test bot, prepending it with the command prefix.

sync
void sync()

Synchronises with the target bot by sending a random number and waiting for it to be echoed back.

triggeredByTimer
auto triggeredByTimer()

Whether or not the last fiber invocation was triggered by a timer.

Static variables

delayBetween
auto delayBetween;

The delay between sending messages.

Variables

channelName
string channelName;

The name of the channel to test in.

fiber
CarryingFiber!IRCEvent fiber;

The CarryingFiber to run the test in.

plugin
IRCPlugin plugin;

The plugin to test.

targetNickname
string targetNickname;

The nickname of the other bot to test against.