File: 05.prop-params.t

package info (click to toggle)
libdata-ical-perl 0.21%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 388 kB
  • ctags: 247
  • sloc: perl: 3,371; sh: 51; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download | duplicates (5)
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
37
38
39
#!/usr/bin/perl -w

use warnings;
use strict;

use Test::More tests => 8;
use Test::LongString;
use Test::NoWarnings;

BEGIN { use_ok('Data::ICal::Entry::Todo') }

my $todo = Data::ICal::Entry::Todo->new();
isa_ok($todo, 'Data::ICal::Entry::Todo');

my $todo_prop = $todo->add_property( summary => [ 'Sum it up.', { language => "en-US", value => "TEXT" } ] ); 
isa_ok($todo_prop, 'Data::ICal::Entry::Todo', "Check if chaining is possible");

# example from RFC 2445 4.2.11
my $todo_props = $todo->add_properties( attendee => [ 'MAILTO:janedoe@host.com', 
    { member => [ 'MAILTO:projectA@host.com', 'MAILTO:projectB@host.com' ] } ]);
isa_ok($todo_props, 'Data::ICal::Entry::Todo', "Check if chaining is possible");

my $expect = <<'END_VCAL';
BEGIN:VTODO
ATTENDEE;MEMBER="MAILTO:projectA@host.com","MAILTO:projectB@host.com":MAILT
 O:janedoe@host.com
SUMMARY;LANGUAGE=en-US;VALUE=TEXT:Sum it up.
END:VTODO
END_VCAL

is_string($todo->as_string( crlf => "\n"), $expect, "Got the right output");

$todo = Data::ICal::Entry::Todo->new({
    summary  => [ 'Sum it up.', { language => "en-US", value => "TEXT" } ],
    attendee => [ 'MAILTO:janedoe@host.com', {
	member => [ 'MAILTO:projectA@host.com', 'MAILTO:projectB@host.com' ] } ],
});
isa_ok($todo, 'Data::ICal::Entry::Todo');
is_string($todo->as_string( crlf => "\n"), $expect, "Got the right output at once");