/
08-html.t
45 lines (36 loc) · 1.02 KB
/
08-html.t
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
# Pragmas.
use strict;
use warnings;
# Modules.
use PPI::HTML::Fragment;
use Test::More 'tests' => 8;
# Test.
my $obj = PPI::HTML::Fragment->new('', 'css');
is($obj->html, '<span class="css"></span>');
# Test.
$obj = PPI::HTML::Fragment->new('string', 'css');
is($obj->html, '<span class="css">string</span>');
# Test.
$obj->clear;
is($obj->html, 'string');
# Test.
$obj = PPI::HTML::Fragment->new('&<>"', 'css');
$obj->clear;
is($obj->html, '&<>"',
'\'&\', \'<\', \'>\' and \'"\' in text.');
# Test.
$obj = PPI::HTML::Fragment->new("text\ntext", 'css');
$obj->clear;
is($obj->html, "text<br>\ntext", '\'\\n\' in text.');
# Test.
$obj = PPI::HTML::Fragment->new("text\r\ntext", 'css');
$obj->clear;
is($obj->html, "text<br>\ntext", '\'\\r\\n\' in text.');
# Test.
$obj = PPI::HTML::Fragment->new("text\r\r\ntext", 'css');
$obj->clear;
is($obj->html, "text<br>\ntext", '\'\\r\\r\\n\' in text.');
# Test.
$obj = PPI::HTML::Fragment->new("text\rtext", 'css');
$obj->clear;
is($obj->html, "text<br>\ntext", '\'\\r\' in text.');