Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 72 lines (58 sloc) 1.932 kB
1dd7321 @dandv Made all tests use strict, removed t/c/journal.t (leftover from old d…
dandv authored
1 #!/usr/bin/env perl
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
2 use strict;
1dd7321 @dandv Made all tests use strict, removed t/c/journal.t (leftover from old d…
dandv authored
3 use warnings;
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
4 use MojoMojo::Formatter::Textile;
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
5 use Test::More tests => 6;
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
6 use Test::Differences;
7
8 my ( $content, $got, $expected, $test );
9
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
10
11 #----------------------------------------------------------------------------
12 $test = 'extra EOL at EOF';
13 $content = 'foo';
14 $expected = "<p>foo</p>\n";
15 is( MojoMojo::Formatter::Textile->main_format_content( \$content ), $expected, $test );
16
17 $test = 'consecutive EOL at EOF collapsed into one';
18 $content = "foo\n\n";
19 $expected = "<p>foo</p>\n";
20 is( MojoMojo::Formatter::Textile->main_format_content( \$content ), $expected, $test );
21
22
23 #----------------------------------------------------------------------------
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
24 $test = 'pre tag - no attribute';
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
25 $content = << 'TEXTILE';
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
26 <pre>
27 Hopen, Norway
28 </pre>
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
29 TEXTILE
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
30
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
31 $expected = <<'HTML';
32 <pre>
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
33 Hopen, Norway
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
34 </pre>
35 HTML
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
36 MojoMojo::Formatter::Textile->main_format_content( \$content );
37 eq_or_diff( $content, $expected, $test );
38
39 $test = 'pre tag - no attribute and some text before a pre tag';
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
40 $content = <<'TEXTILE';
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
41 Tinc família a
42 <pre>
43 Hopen, Norway
44 </pre>
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
45 TEXTILE
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
46
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
47 $expected = <<'HTML';
48 <p>Tinc família a</p>
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
49
50
51 <pre>
52 Hopen, Norway
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
53 </pre>
54 HTML
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
55 MojoMojo::Formatter::Textile->main_format_content( \$content );
56 eq_or_diff( $content, $expected, $test );
57
58 $test = 'remote image';
59 $content = '<img src="http://far.away.com/imatge.jpg" />';
5afff38 @dandv Ensure that formatter output ends uniformly with exactly one newline.
dandv authored
60 $expected = '<p><img src="http://far.away.com/imatge.jpg" /></p>' . "\n";
146fca2 @mateu More Testing of Defang with wiki Thang.
mateu authored
61 MojoMojo::Formatter::Textile->main_format_content( \$content );
62 eq_or_diff( $content, $expected, $test );
6abf6d2 @dandv Stop Textile from encoding non-ASCII Unicode characters into HTML ent…
dandv authored
63
64 #----------------------------------------------------------------------------
65 $test = "Do not encode non-markup Unicode characters";
66 $content = <<'TEXTILE';
67 Odd as they may be, leave these characters alone:
68 להפסיק להשתמש המזוין שפות זרות
69 áéíóú¿¡üñ
70 TEXTILE
71 eq_or_diff( MojoMojo::Formatter::Textile->main_format_content( \$content ), $content, $test );
Something went wrong with that request. Please try again.