1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/perl
use v5.14;
use warnings;
use Test::More;
use Protocol::IRC::Message;
sub test_named
{
my ( $command, $args, $line ) = @_;
my $message = Protocol::IRC::Message->new_from_named_args( $command, %$args );
is( $message->stream_to_line, $line, "\$message->line for $command" );
}
test_named PING =>
{ text => "123" },
"PING 123";
test_named PRIVMSG =>
{ text => "the message", targets => "#channel" },
"PRIVMSG #channel :the message";
test_named KICK =>
{ text => "go away", target_name => "#channel", kicked_nick => "BadUser" },
"KICK #channel BadUser :go away";
done_testing;
|