#!perl -w
use strict;
use Data::Microformat::hCard::type;
use Test::More tests => 18;
#Basic type taken from the microformats wiki: http://microformats.org/wiki/hcard
my $simple = << 'EOF';
Home
+1.415.555.1212
EOF
ok(my $type = Data::Microformat::hCard::type->parse($simple));
is($type->kind, "tel");
is($type->type, "Home");
is($type->value, "+1.415.555.1212");
my $comparison = << 'EOF';
EOF
is ($type->to_hcard, $comparison);
my $text_comparison = << 'EOF';
tel:
value: +1.415.555.1212
type: Home
EOF
is($type->to_text, $text_comparison);
my $medium = << 'EOF';
Work test@example.com
EOF
ok($type = Data::Microformat::hCard::type->parse($medium));
is($type->kind, "email");
is($type->type, "Work");
is($type->value, 'test@example.com');
$comparison = << 'EOF';
EOF
is($type->to_hcard, $comparison);
$text_comparison = << 'EOF';
email:
value: test@example.com
type: Work
EOF
is($type->to_text, $text_comparison);
my $hard = << 'EOF';
Email
EOF
ok($type = Data::Microformat::hCard::type->parse($hard));
is ($type->value, 'test@example.com');
$comparison = << 'EOF';
EOF
is($type->to_hcard, $comparison);
$text_comparison = << 'EOF';
email:
value: test@example.com
EOF
is($type->to_text, $text_comparison);
# Psychotic test brought to you by http://hcard.geekhood.net/encode/
my $psychotic = << 'EOF';
test@example.com
EOF
ok($type = Data::Microformat::hCard::type->parse($psychotic));
is ($type->value, 'test@example.com');