File: formatter-wafl.t

package info (click to toggle)
libspoon-perl 0.24-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 296 kB
  • sloc: perl: 2,640; makefile: 2
file content (74 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download | duplicates (3)
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
72
73
74
use lib 't', 'lib';
use strict;
use warnings;
use Spoon;

use Test::More tests => 6;
use Formatter;

my $hub = Spoon->new->load_hub(
    {
        formatter_class => 'Test::Formatter',
    }
);

my $formatter = $hub->formatter;

{
    my $html = $formatter->text_to_html(<<'EOF');
{phrase1: testing}
EOF

    like( $html, qr{<span class="phrase1">testing</span>},
          'Basic WAFL phrase formatting' );
}

{
    my $html = $formatter->text_to_html(<<'EOF');
{Phrase1: testing}
EOF

    like( $html, qr{<span class="phrase1">testing</span>},
          'Basic WAFL phrase formatting - case insensitive' );
}


{
    my $html = $formatter->text_to_html(<<'EOF');
.block1
block contents
.block1
EOF

    like( $html, qr{<div class="block1">\s*block contents\s*</div>}s,
          'Basic WAFL block formatting' );
}

{
    my $html = $formatter->text_to_html(<<'EOF');
.blOCK1
block contents
.blOCK1
EOF

    like( $html, qr{<div class="block1">\s*block contents\s*</div>}s,
          'Basic WAFL block formatting - case insensitive' );
}

{
    my $html = $formatter->text_to_html(<<'EOF');
{underline_name: testing}
EOF

    like( $html, qr{<span class="underline_name">testing</span>}s,
          'underline in wafl name' );
}

{
    my $html = $formatter->text_to_html(<<'EOF');
{underline-name: testing}
EOF

    like( $html, qr{<span class="underline_name">testing</span>}s,
          'dash in wafl name' );
}