File: treebuilder_problem.t

package info (click to toggle)
libhtml-formattext-withlinks-perl 0.15-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 192 kB
  • sloc: perl: 246; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (5)
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
use Test::More;

BEGIN {
    eval "use Test::MockObject";
    if ( $@ ) {
        plan skip_all => "Test::MockObject  required for testing TreeBuilder problems";
    } else {
        plan tests => 3;
    }

    my $m = Test::MockObject->new();
    $m->fake_new( 'HTML::TreeBuilder' );
    $m->mock( 'parse', sub { $! = 1122; return undef; } );
};

use HTML::FormatText::WithLinks;

my $f = HTML::FormatText::WithLinks->new( );

ok($f, 'object created');

my $text = $f->parse('<html><head></head><body><p>some text</p></body></html>');

is($text, undef, 'undef returned for broken HTML::TreeBuilder');
like($f->error, qr/^HTML::TreeBuilder problem: /,
                'correct error message for broken HTML::TreeBuilder');