-
Notifications
You must be signed in to change notification settings - Fork 22
/
03-link.t
40 lines (30 loc) · 1001 Bytes
/
03-link.t
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
# $Id$
use strict;
use Test::More tests => 14;
use XML::Atom::Link;
my $link;
$link = XML::Atom::Link->new;
isa_ok $link, 'XML::Atom::Link';
ok $link->elem;
$link->title('This is a test.');
is $link->title, 'This is a test.';
$link->title('Different title.');
is $link->title, 'Different title.';
$link->title('This is a test.');
$link->rel('alternate');
is $link->rel, 'alternate';
$link->href('http://www.example.com/');
is $link->href, 'http://www.example.com/';
$link->type('text/html');
is $link->type, 'text/html';
my $xml = $link->as_xml;
like $xml, qr/^<\?xml version="1.0" encoding="UTF-8"\?>/;
like $xml, qr/<link xmlns="http:\/\/purl.org\/atom\/ns#"/;
like $xml, qr/title="This is a test."/;
like $xml, qr/rel="alternate"/;
like $xml, qr/href="http:\/\/www.example.com\/"/;
like $xml, qr/type="text\/html"/;
my $ns = XML::Atom::Namespace->new(dc => "http://purl.org/dc/elements/1.1/");
$link->set($ns, "subject" => "blah");
$xml = $link->as_xml;
like $xml, qr/dc:subject="blah"/;