File: 001_load_action.t

package info (click to toggle)
libnet-sieve-script-perl 0.07-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 256 kB
  • ctags: 146
  • sloc: perl: 2,087; makefile: 41
file content (35 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download | duplicates (4)
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
use Test::More tests => 10;
use strict;

use lib qw(lib);

BEGIN { use_ok( 'Net::Sieve::Script::Action' ); }

my $command = ' fileinto "INBOX.spam" ';

my $action = Net::Sieve::Script::Action->new($command);

is ( $action->command, 'fileinto', "command fileinto");
is ( $action->param, '"INBOX.spam"', "param INBOX.spam");

$action = Net::Sieve::Script::Action->new('stop');
is ( $action->command, 'stop', "command stop");

$action = Net::Sieve::Script::Action->new('redirect "bart@example.edu"');
is ( $action->command, 'redirect', "command redirect");
is ( $action->param, '"bart@example.edu"', 'param bart@example.edu');

$action = Net::Sieve::Script::Action->new('nimp "bart@example.edu"');
is ( $action->command, undef, "undef for command nimp");

$action = Net::Sieve::Script::Action->new('vacation "I am away this week.";');
is ( $action->command, 'vacation' , "vacation command");
is ( $action->param, '"I am away this week."' , "vacation param");

my $multi_line_param = 'text: some text 
on multi-line 
.';

my $command2 = ' reject '.$multi_line_param; 
my $action2 = Net::Sieve::Script::Action->new($command2);
is ( $action2->param, $multi_line_param , "match mult-line param");