Add ARM files
[dh-make-perl] / dev / arm / libhtml-parser-perl / libhtml-parser-perl-3.56 / t / linkextor-base.t
1 # This test that HTML::LinkExtor really absolutize links correctly
2 # when a base URL is given to the constructor.
3
4 use Test::More tests => 5;
5 require HTML::LinkExtor;
6
7 SKIP: {
8 eval {
9    require URI;
10 };
11 skip $@, 5 if $@;
12
13 # Try with base URL and the $p->links interface.
14 $p = HTML::LinkExtor->new(undef, "http://www.sn.no/foo/foo.html");
15 $p->parse(<<HTML)->eof;
16 <head>
17 <base href="http://www.sn.no/">
18 </head>
19 <body background="http://www.sn.no/sn.gif">
20
21 This is <A HREF="link.html">link</a> and an <img SRC="img.jpg"
22 lowsrc="img.gif" alt="Image">.
23 HTML
24
25 @p = $p->links;
26
27 # There should be 4 links in the document
28 is(@p, 4);
29
30 for (@p) {
31     ($t, %attr) = @$_ if $_->[0] eq 'img';
32 }
33
34 is($t, 'img');
35
36 is(delete $attr{src}, "http://www.sn.no/foo/img.jpg");
37
38 is(delete $attr{lowsrc}, "http://www.sn.no/foo/img.gif");
39
40 ok(!scalar(keys %attr)); # there should be no more attributes
41 }