File: 12-title-fallback.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 (41 lines) | stat: -rwxr-xr-x 1,361 bytes parent folder | download | duplicates (7)
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
41
use strict;
use Test::More tests => 1+6*2;

BEGIN {
  use_ok( "Test::HTML::Content");

  if ($Test::HTML::Content::can_xpath) {
    require Test::HTML::Content::NoXPath;
    &Test::HTML::Content::NoXPath::install;
  };
};

eval {
  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"A test title","Title RE");
};
is( $@, "", "Gracefull title fallback (title_ok)" );

eval {
  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"^A test title$","Anchored title RE");
};
is( $@, "", "Gracefull title fallback (title_ok)" );

eval {
  title_ok('<html><head><title>A test title</title></head><body></body></html>',qr"test","Title RE works for partial matches");
};
is( $@, "", "Gracefull title fallback (title_ok)" );

eval {
  title_ok('<html><head><title>A test title</title></head><body></body></html>',"A test title","Title string");
};
is( $@, "", "Gracefull title fallback (title_ok)" );

eval {
  no_title('<html><head><title>A test title</title></head><body></body></html>',"test","Complete title string gets compared");
};
is( $@, "", "Gracefull title fallback (no_title)" );

eval {
  no_title('<html><head><title>A test title</title></head><body></body></html>',"A toast title","no_title string");
};
is( $@, "", "Gracefull title fallback (no_title)" );