my
$in_file
= path(
't'
,
'unwrap.vcf'
);
note
"Importing $in_file with Addressbook->load()"
;
my
$address_book
= Text::vCard::Addressbook->load( [
$in_file
] );
my
$vcard
=
$address_book
->vcards->[0];
my
$expected_content
=
$in_file
->slurp_utf8;
my
$actual_content
=
$vcard
->as_string();
my
$N
=
qr(/(N;CH[^\r]\r\n(?:[ \t][^\r]*\r\n)
*)/s);
my
$ADR
=
qr(/(ADR;[^\r]\r\n(?:[ \t][^\r]*\r\n)
*)/s);
my
$NOTE
=
qr(/(NOTE[^\r]\r\n(?:[ \t][^\r]*\r\n)
*)/s);
is
$actual_content
=~
$N
,
$expected_content
=~
$N
,
'vCard->as_string() N ?'
;
is
$actual_content
=~
$ADR
,
$expected_content
=~
$ADR
,
'vCard->as_string() ADR key?'
;
is
$actual_content
=~
$NOTE
,
$expected_content
=~
$NOTE
,
'vCard->as_string() NOTE key?'
;
is
$address_book
->export(),
$actual_content
,
'Addressbook->export()'
;
done_testing;