File: 03-links.t

package info (click to toggle)
libtest-html-content-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 328 kB
  • sloc: perl: 1,393; makefile: 2
file content (18 lines) | stat: -rwxr-xr-x 816 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl -w
use strict;
use lib 't';
use testlib;

sub run {
  # Tests for links
  no_link('<html></html>','http://www.perl.com', "Simple non-existing link");
  no_link('<html>http://www.perl.com</html>',"http://www.perl.com", "Plain text gets not interpreted as link");
  link_ok('<html><a href="http://www.perl.com">Title</a></html>',"http://www.perl.com", "A link is found");
  link_count('<html><A href="http://www.perl.com">Icon</a><a href="http://www.perl.com">Title</a></html>',"http://www.perl.com", 2,"A link that appears twice is reported twice");

  link_ok('<html>Mail me at <!-- href="corion@cpan.org" -->
                    <a href="corion@somewhere.else"></a> some address</html>',
      'corion@somewhere.else', "Links are not found if commented out");
};

runtests(5,\&run);