File: jidsplit.t

package info (click to toggle)
libanyevent-xmpp-perl 0.55-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 784 kB
  • ctags: 553
  • sloc: perl: 8,004; makefile: 13
file content (21 lines) | stat: -rw-r--r-- 601 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl
use strict;
use Test::More;
use AnyEvent::XMPP::Util qw/split_jid/;

my @data = (
   ['msn.im.sapo.pt'        => undef,   'msn.im.sapo.pt', undef],
   ['elmex@jabber.org/test' => 'elmex', 'jabber.org',     'test'],
   ['jabber.org/test'       => undef,   'jabber.org',     'test'],
   ['elmex@jabber.org'      => 'elmex', 'jabber.org',     undef],
);

plan tests => (scalar @data) * 3;

for (@data) {
   my ($n, $h, $r) = split_jid ($_->[0]);

   is ($n, $_->[1], "jid [$_->[0]]: node empty");
   is ($h, $_->[2], "jid [$_->[0]]: host");
   is ($r, $_->[3], "jid [$_->[0]]: resource empty");
}