File: parse_with_name.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 (39 lines) | stat: -rw-r--r-- 834 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
27
28
29
30
31
32
33
34
35
36
37
38
39
# $Id$

use Test::More tests => 6;
use HTML::FormatText::WithLinks;

my $html = new_html();
my $f = HTML::FormatText::WithLinks->new( leftmargin => 0 );

ok($f, 'object created');

my $text = $f->parse($html);

my $correct_text = qq!This is a mail of some sort with a link.

!;

ok($text, 'html formatted');
is($text, $correct_text, 'html with name only link correctly formatted');

my $f2 = HTML::FormatText::WithLinks->new( leftmargin => 0,
                                           base       => 'http://example.com' );
ok($f2, 'object created');

$text = $f2->parse($html);

ok($text, 'html formatted');
is($text, $correct_text, 'html with name only link and base set correctly formatted');

sub new_html {
return <<'HTML';
<html>
<body>
<p>
This is a mail of some sort with a <a name="foo">link</a>.
</p>
</body>
</html>
HTML
}