File: basic.t

package info (click to toggle)
perl 5.40.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 126,152 kB
  • sloc: ansic: 668,539; perl: 525,522; sh: 72,038; pascal: 6,925; xml: 2,428; yacc: 1,410; makefile: 1,191; cpp: 208; lisp: 1
file content (88 lines) | stat: -rw-r--r-- 2,445 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
use strict;
use warnings;
use Test::More tests => 29;

#use Pod::Simple::Debug (6);

require Pod::Simple::BlackBox;
ok 1;

require Pod::Simple; ok 1;

Pod::Simple->VERSION(.90); ok 1;

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

require Pod::Simple::DumpAsXML; ok 1;

require Pod::Simple::XMLOutStream; ok 1;

BEGIN {
  require FindBin;
  unshift @INC, $FindBin::Bin . '/lib';
}
use helpers;

print "# Simple identity tests...\n";

&is( e "", "" );
&is( e "\n", "", );
&is( e "\n", "\n", );
&is( e "puppies\n\n\n\n", "", );


print "# Contentful identity tests...\n";

&is( e "=pod\n\nFoo\n",         "=pod\n\nFoo\n"         );
&is( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" );
&is( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\nFoo\n"         );

# Now with some more newlines
&is( e "\n\n=pod\n\nFoo\n",     "\n\n=pod\n\nFoo\n"     );
&is( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" );
&is( e "=pod\n\n\n\nFoo\n\n\n", "\n\n=pod\n\nFoo\n"     );


&is( e "=head1 Foo\n",          "=head1 Foo\n"          );
&is( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n\n=cut\n"  );
&is( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n"          );

# Now just add some newlines...
&is( e "\n\n\n\n=head1 Foo\n",  "\n\n\n\n=head1 Foo\n"  );
&is( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n\n=cut\n"  );
&is( e "=head1 Foo\n\n=cut\n",  "\n\n\n\n=head1 Foo\n"  );


print "# Simple XMLification tests...\n";

is( Pod::Simple::XMLOutStream->_out("\n\n\nprint \$^T;\n\n\n"),
    qq{<Document\ncontentless="1"></Document>}
     # make sure the contentless flag is set
);
is( Pod::Simple::XMLOutStream->_out("\n\n"),
    qq{<Document\ncontentless="1"></Document>}
     # make sure the contentless flag is set
);
is( Pod::Simple::XMLOutStream->_out("\n"),
    qq{<Document\ncontentless="1"></Document>}
     # make sure the contentless flag is set
);
is( Pod::Simple::XMLOutStream->_out(""),
    qq{<Document\ncontentless="1"></Document>}
     # make sure the contentless flag is set
);

ok( Pod::Simple::XMLOutStream->_out('', '<Document></Document>' ) );

is( Pod::Simple::XMLOutStream->_out("=pod\n\nFoo\n"),
    '<Document><Para>Foo</Para></Document>'
);

is( Pod::Simple::XMLOutStream->_out("=head1 Chacha\n\nFoo\n"),
    '<Document><head1>Chacha</head1><Para>Foo</Para></Document>'
);

# Make sure an obviously invalid Pod tag is invalid.
is( Pod::Simple::XMLOutStream->_out("=F\0blah\n\nwhatever\n"),
    qq{<Document\ncontentless="1"></Document>}
);