File: 12-title.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 (17 lines) | stat: -rwxr-xr-x 937 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use strict;
use Test::More tests => 7;

BEGIN {
  use_ok( "Test::HTML::Content" );
};
SKIP: {
  skip "XML::XPath or XML::LibXML is needed for title testing", 6
    unless $Test::HTML::Content::can_xpath;

  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"A test title","Title RE");
  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"^A test title$","Anchored title RE");
  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"test","Title RE works for partial matches");
  title_ok('<html><head><title>A test title</title></head><body></body></html>',"A test title","Title string");
  no_title('<html><head><title>A test title</title></head><body></body></html>',"test","Complete title string gets compared");
  no_title('<html><head><title>A test title</title></head><body></body></html>',"A toast title","no_title string");
};