File: 06-encoding.t

package info (click to toggle)
libtext-vcard-perl 3.06-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 352 kB
  • ctags: 110
  • sloc: perl: 1,535; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 865 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
#!/usr/bin/perl -w

use strict;

use lib qw(./lib);

use Test::More tests => 7;

# Check we can load module
BEGIN { use_ok('Text::vCard::Addressbook'); }

my $card_type = 'encoding.vcf';

ok( $card_type, "Running from $card_type" );
my $adbk = Text::vCard::Addressbook->new( { source_file => "t/$card_type" } );
isa_ok( $adbk, 'Text::vCard::Addressbook' );
my $vcards = $adbk->vcards();

is( scalar( @{$vcards} ), 1, "$card_type has 1 vcards as expected" );
my $vcard = $vcards->[0];
is( $vcard->get('fn')->[0]->value(),
    'Nathan Paul Christiansen I',
    "$card_type has fn data correct"
);

# print Dumper($vcard);
my $a = $vcard->get(
    {   'node_type' => 'ADR',
        'types'     => 'work',
    }
)->[0];
is( $a->street(),
    "Software Development\x0D\x0A333 West River Park Drive",
    'Match on street'
);
is( $a->city(), 'Provo', 'Match on city' );