File: 04message-from-named.t

package info (click to toggle)
libprotocol-irc-perl 0.13-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 264 kB
  • sloc: perl: 2,122; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 625 bytes parent folder | download
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;