File: lines.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 (59 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download | duplicates (4)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use strict;
use warnings;

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

sub rt_ok { # C&P also in t/blocks.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 = "line1";
    is_deeply(HTML::Quoted->extract($a),[{raw => 'line1'}]);
    rt_ok($a);
}

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

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