File: 10.mime-vcal10.t

package info (click to toggle)
libdata-ical-perl 0.24%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 3,465; makefile: 2
file content (77 lines) | stat: -rw-r--r-- 1,626 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl -w

use warnings;
use strict;

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

my $encoded_vcal_in = <<END_VCAL;
BEGIN:VCALENDAR
VERSION:1.0
PRODID:Data::ICal @{[$Data::ICal::VERSION]}
BEGIN:VTODO
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYeah=
!!=3D =63bla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
END:VTODO
END:VCALENDAR
END_VCAL

my $encoded_vcal_out = <<END_VCAL;
BEGIN:VCALENDAR
VERSION:1.0
PRODID:Data::ICal @{[$Data::ICal::VERSION]}
BEGIN:VTODO
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYeah!!=3D cbla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
END:VTODO
END:VCALENDAR
END_VCAL

my $decoded_desc = <<'END_DESC';
interesting things         
Yeah!!= cbla


Go team syncml!


END_DESC

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

my $cal = Data::ICal->new(data => $encoded_vcal_in, vcal10 => 1);

isa_ok($cal, 'Data::ICal');

is_string($cal->entries->[0]->property("description")->[0]->decoded_value, $decoded_desc);

$cal = Data::ICal->new;

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

$cal = Data::ICal->new(vcal10 => 1);

isa_ok($cal, 'Data::ICal');

my $todo = Data::ICal::Entry::Todo->new;
$cal->add_entry($todo);

$todo->add_property(description => $decoded_desc);

$cal->entries->[0]->property('description')->[0]->encode('QUotED-PRintabLE');
is($cal->as_string( crlf => "\n"), $encoded_vcal_out);


__END__
possibly useful later
DESCRIPTION;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:interesting thi=
ngs         =0D=0A=
Yeah!!=3D =C3=AAtre=0D=0A=
=0D=0A=
=0D=0A=
Go team syncml!=0D=0A=
=0D=0A=
=0D=0A=
END_DESC