File: 001_load_vacation.t

package info (click to toggle)
libnet-sieve-script-perl 0.09-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 2,819; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,017 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
36
use Test::More tests => 4;
use strict;

use lib qw(lib);

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

my $script = Net::Sieve::Script->new();

$script->raw('require "vacation";
   vacation :days 23 :addresses ["tjs@example.edu",
                                 "ts4z@landru.example.edu"]
   "I\'m away until October 19.
   If it\'s an emergency, call 911, I guess." ;');

my $text = 'require "vacation"; vacation :days 23 :addresses ["tjs@example.edu", "ts4z@landru.example.edu"] "I\'m away until October 19.  If it\'s an emergency, call 911, I guess.";';

$script->read_rules();

#use Data::Dumper;

#print Dumper $script;

ok ($script->parsing_ok, "simple vacation");

my $text2 = 'require "vacation";
   if header :contains "subject" "cyrus" {
       vacation "I\'m out -- send mail to cyrus-bugs";
   } else {
       vacation "I\'m out -- call me at +1 304 555 0123";
   }';
$script->read_rules($text2);
is ( _strip($script->write_script),_strip($text2)," vacation");