File: 10-errors.text.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 (37 lines) | stat: -rwxr-xr-x 896 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
# Test script to test the failure modes of Test::HTML::Content
use Test::More;

eval {
  require Test::Builder::Tester;
  Test::Builder::Tester->import;
};

if ($@) {
  plan skip_all => "Test::Builder::Tester required for testing error messages";
}

plan tests => 1+1*2;

use_ok('Test::HTML::Content');

# Test that each exported function fails as documented

sub run_tests {
  test_out("not ok 1 - Text failure (empty document)");
  test_fail(+1);
  text_ok("","Perl","Text failure (empty document)");

  no warnings 'once';
  if ($Test::HTML::Content::can_xpath) {
    test_diag( 'Invalid HTML:', "" );
  } else {
    test_diag( 'No text found at all', "Expected at least one text element like 'Perl'" );
  };

  test_test("Empty document gets reported");
};

run_tests;
require Test::HTML::Content::NoXPath;
Test::HTML::Content::NoXPath->install;
run_tests;