/
05-headings.t
71 lines (59 loc) · 1.67 KB
/
05-headings.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use v6;
use Test;
plan 4;
use Text::Markup::Wiki::MediaWiki;
my $converter = Text::Markup::Wiki::MediaWiki.new;
{
my @pars =
"==heading 1==",
"par 1",
"== heading 2 ==",
"== heading 3 ==",
"par 2";
my $input = join "\n\n", @pars;
my $expected_output = join "\n\n",
'<h2>heading 1</h2>',
'<p>par 1</p>',
'<h2>heading 2</h2>',
'<h2>heading 3</h2>',
'<p>par 2</p>';
my $actual_output = $converter.format($input);
is( $actual_output, $expected_output,
'mixing paragraphs and headings works' );
}
{
# RAKUDO: heredocs
my $input = '== Mr Heading ==
...and immediately some paragraph text.';
my $expected_output = join "\n\n",
'<h2>Mr Heading</h2>',
'<p>...and immediately some paragraph text.</p>';
my $actual_output = $converter.format($input);
is( $actual_output, $expected_output,
'really mixing paragraphs and headings works I' );
}
{
# RAKUDO: heredocs
my $input = 'Some text.
==Mr Surprise Heading==';
my $expected_output = join "\n\n",
'<p>Some text.</p>',
'<h2>Mr Surprise Heading</h2>';
my $actual_output = $converter.format($input);
is( $actual_output, $expected_output,
'really mixing paragraphs and headings works II' );
}
{
# RAKUDO: heredocs
my $input = 'Paragraph.
==Heading==
Paragraph.';
my $expected_output = join "\n\n",
'<p>Paragraph.</p>',
'<h2>Heading</h2>',
'<p>Paragraph.</p>';
my $actual_output = $converter.format($input);
is( $actual_output, $expected_output,
'really mixing paragraphs and headings works III' );
}
# vim:ft=perl6