Skip to content

Commit

Permalink
Add tests/libera.d
Browse files Browse the repository at this point in the history
  • Loading branch information
zorael committed Jan 23, 2025
1 parent 5db390c commit f61ca09
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/libera.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import lu.conv : Enum;
import dialect;
import std.conv : to;

unittest
{
IRCParser parser;

with (parser)
{
client.nickname = "kameloso";
client.user = "kameloso";
client.realName = "kameloso IRC bot";
client.ident = "~kameloso";
server.address = "irc.libera.chat";
server.daemon = IRCServer.Daemon.solanum;
server.network = "Libera.Chat";
server.aModes = "eIbq";
server.bModes = "k";
server.cModes = "flj";
server.dModes = "CFLMPQScgimnprstuz";
server.prefixchars = ['v':'+', 'o':'@'];
server.prefixes = "ov";
}

parser.typenums = typenumsOf(parser.server.daemon);

{
enum input = ":silver.libera.chat 338 zorael deadmarshal 2605:6400:10:5bf:6f87:849d:f61e:2c8c :actually using host";
immutable event = parser.toIRCEvent(input);

with (event)
{
assert((type == IRCEvent.Type.RPL_WHOISACTUALLY), Enum!(IRCEvent.Type).toString(type));
assert((num == 338), num.to!string);
assert((sender.address == "silver.libera.chat"), sender.address);
assert((target.nickname == "deadmarshal"), target.nickname);
assert((content == "actually using host"), content);
assert((aux[0] == "2605:6400:10:5bf:6f87:849d:f61e:2c8c"), aux[0]);
}
}
}

0 comments on commit f61ca09

Please sign in to comment.