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