File: fcodes.t

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (113 lines) | stat: -rw-r--r-- 4,174 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use strict;
use warnings;
use Test::More tests => 21;

#use Pod::Simple::Debug (5);
BEGIN {
  require FindBin;
  unshift @INC, $FindBin::Bin . '/lib';
}
use helpers;

use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";

print "# With weird leading whitespace...\n";
# With weird whitespace
is( Pod::Simple::XMLOutStream->_out("=pod\n\nI<foo>\n"),
 '<Document><Para><I>foo</I></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB< foo>\n"),
 '<Document><Para><B> foo</B></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB<\tfoo>\n"),
 '<Document><Para><B> foo</B></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB<\nfoo>\n"),
 '<Document><Para><B> foo</B></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB<foo>\n"),
 '<Document><Para><B>foo</B></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB<foo\t>\n"),
 '<Document><Para><B>foo </B></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nB<foo\n>\n"),
 '<Document><Para><B>foo </B></Para></Document>'
);


print "#\n# Tests for wedges outside of formatting codes...\n";
&is( Pod::Simple::XMLOutStream->_out("=pod\n\nX < 3 and N > 19\n"),
     Pod::Simple::XMLOutStream->_out("=pod\n\nX E<lt> 3 and N E<gt> 19\n")
);


print "# A complex test with internal whitespace...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nI<foo>B< bar>C<baz >F< quux\t?>\n"),
 '<Document><Para><I>foo</I><B> bar</B><C>baz </C><F> quux ?</F></Para></Document>'
);


print "# Without any nesting...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nF<a>C<b>I<c>B<d>X<e>\n"),
 '<Document><Para><F>a</F><C>b</C><I>c</I><B>d</B><X>e</X></Para></Document>'
);

print "# Without any nesting, but with Z's...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>F<a>C<b>I<c>B<d>X<e>\n"),
 '<Document><Para><F>a</F><C>b</C><I>c</I><B>d</B><X>e</X></Para></Document>'
);


print "# With lots of nesting, and Z's...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>F<C<Z<>foo> I<bar>> B<X<thingZ<>>baz>\n"),
 '<Document><Para><F><C>foo</C> <I>bar</I></F> <B><X>thing</X>baz</B></Para></Document>'
);



print "#\n# *** Now testing different numbers of wedges ***\n";
print "# Without any nesting...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< a >>C<<< b >>>I<<<< c >>>>B<< d >>X<< e >>\n"),
 '<Document><Para><F>a</F><C>b</C><I>c</I><B>d</B><X>e</X></Para></Document>'
);

print "# Without any nesting, but with Z's, and odder whitespace...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< aZ<> >>C<<< Z<>b >>>I<<<< c  >>>>B<< d \t >>X<<\ne >>\n"),
  '<Document><Para><F>a</F><C>b</C><I>c</I><B>d</B><X>e</X></Para></Document>'
);

print "# With nesting and Z's, and odder whitespace...\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< aZ<> >>C<<< Z<>bZ<>B<< d \t >>X<<\ne >> >>>I<<<< c  >>>>\n"),
 "<Document><Para><F>a</F><C>b<B>d</B><X>e</X></C><I>c</I></Para></Document>"
);

print "# Regression https://rt.cpan.org/Ticket/Display.html?id=55602 (vs 12239)\n";
is( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< foo->bar >>>\n"),
 '<Document><Para><C>foo-&#62;bar</C></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< C<foo> >>>\n"),
 '<Document><Para><C><C>foo</C></C></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< C<<foo>> >>>\n"),
 '<Document><Para><C><C>&#60;foo</C>&#62;</C></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< CZ<><<foo>> >>>\n"),
 '<Document><Para><C>C&#60;&#60;foo&#62;&#62;</C></Para></Document>'
);
is( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< CE<lt><foo>> >>>\n"),
 '<Document><Para><C>C&#60;&#60;foo&#62;&#62;</C></Para></Document>'
);

print "# Misc...\n";
is( Pod::Simple::XMLOutStream->_out(
 "=pod\n\nI like I<PIE> with B<cream> and Stuff and N < 3 and X<< things >> hoohah\n"
."And I<pie is B<also> a happy time>.\n"
."And B<I<<< I like pie >>>.>\n"
) =>
"<Document><Para>I like <I>PIE</I> with <B>cream</B> and Stuff and N &#60; 3 and <X>things</X> hoohah "
."And <I>pie is <B>also</B> a happy time</I>. "
."And <B><I>I like pie</I>.</B></Para></Document>"
);