This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bring Pod::Simple up to 3.10
[perl5.git] / cpan / Pod-Simple / t / fullstop.t
1 # Testing hardening fullstop spaces
2 BEGIN {
3     if($ENV{PERL_CORE}) {
4         chdir 't';
5         @INC = '../lib';
6     }
7 }
8
9 use strict;
10 use Test;
11 BEGIN { plan tests => 11 };
12
13 #use Pod::Simple::Debug (6);
14
15 print "# Hi, I'm ", __FILE__, "\n";
16 ok 1;
17
18 use Pod::Simple;
19 use Pod::Simple::DumpAsXML;
20 use Pod::Simple::XMLOutStream;
21 print "# Pod::Simple version $Pod::Simple::VERSION\n";
22 sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
23
24 &ok( e "", "" );
25 &ok( e "\n", "", );
26
27 die unless ok !! Pod::Simple::XMLOutStream->can('fullstop_space_harden');
28 sub harden { $_[0]->fullstop_space_harden(1) }
29
30 print "# Test that \".  \" always compacts without the hardening on...\n";
31
32 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D.  I\ncalled back!\n"),
33   qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
34 );
35 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D. I called back!\n"),
36   qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
37 );
38 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D.\nI called back!\n"),
39   qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
40 );
41
42
43 print "# Now testing with the hardening on...\n";
44
45 ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D.  I\ncalled back!\n"),
46   qq{<Document><Para>She set me a message about the M.D.&#160; I called back!</Para></Document>}
47 );
48 ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D. I called back!\n"),
49   qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
50 );
51 ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D.\nI called back!\n"),
52   qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
53 );
54
55
56 print "# Byebye\n";
57 ok 1;
58