File: 04.mandatory-props.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 (36 lines) | stat: -rw-r--r-- 747 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w

use warnings;
use strict;

use Test::More tests => 6;
use Test::LongString;
use Test::Warn;

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

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

my $cal = Data::ICal->new;
isa_ok($cal, 'Data::ICal');

$cal->add_entry($todo);

# breaking the abstraction, ah well
$cal->properties->{'prodid'} = [];

my $str;

warning_is { $str = $cal->as_string( crlf => "\n") }
    {carped => "Mandatory property for Data::ICal missing: prodid"}, 
    "Got a warning for missing mandatory property";

is_string($str, <<END_VCAL, "Got the 'right' output anyway");
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VTODO
END:VTODO
END:VCALENDAR
END_VCAL