File: 03-window.t

package info (click to toggle)
alice 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 960 kB
  • sloc: perl: 4,116; sql: 8; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 986 bytes parent folder | download | duplicates (3)
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
32
33
34
35
36
use Test::More;
use App::Alice;
use App::Alice::Test::NullHistory;
use Test::TCP;

my $history = App::Alice::Test::NullHistory->new;
my $app = App::Alice->new(
  history => $history,
  standalone => 0,
  path => 't/alice',
  file => "test_config",
  port => empty_port(),
);

$app->add_irc_server("test", {
  nick => "tester",
  host => "not.real.server",
  port => 6667,
  autoconnect => 0,
});

my $irc = $app->get_irc("test");

my $window = $app->create_window("test-window", $irc);
ok $window->type eq "privmsg", "correct window type for privmsg";
ok !$window->is_channel, "is_channel false for privmsg";
$app->remove_window($window->id);

$window = $app->create_window("#test-window", $irc);
ok $window->type eq "channel", "correct window type for channel";
ok $window->is_channel, "is_channel for channel";
is $window->title, "#test-window", "window title";
is $window->nick, "tester", "nick";
is $window->topic->{string}, "no topic set", "default window topic";

done_testing();