File: blocks.t

package info (click to toggle)
libhtml-quoted-perl 0.05-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 156 kB
  • sloc: perl: 1,585; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download
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
42
use strict;
use warnings;

use Test::More tests => 9;
BEGIN { use_ok('HTML::Quoted') };

sub rt_ok { # C&P also in t/lines.t
    my $text = shift;
    local $Test::Builder::Level = $Test::Builder::Level + 1;
    is(
        HTML::Quoted->combine_hunks( HTML::Quoted->extract( $text ) ),
        $text,
        "round trips okay",
    );
}

use Data::Dumper;
{
    my $a = "<div>line1</div>";
    is_deeply(HTML::Quoted->extract($a),[{raw => '<div>line1</div>', block => 1 }])
        or diag Dumper(HTML::Quoted->extract($a));
    rt_ok($a);
}
{
    my $a = "<div />";
    is_deeply(HTML::Quoted->extract($a),[{raw => '<div />', block => 1 }])
        or diag Dumper(HTML::Quoted->extract($a));
    rt_ok($a);
}
{
    my $a = "<div></div><br />";
    is_deeply(HTML::Quoted->extract($a),[{raw => '<div></div>', block => 1 },{raw => '<br />'}])
        or diag Dumper(HTML::Quoted->extract($a));
    rt_ok($a);
}

{
    my $a = "<div></div><hr>";
    is_deeply(HTML::Quoted->extract($a),[{raw => '<div></div>', block => 1 },{raw => '<hr>'}])
        or diag Dumper(HTML::Quoted->extract($a));
    rt_ok($a);
}