summaryrefslogtreecommitdiff
path: root/cpan/Pod-Simple/t/fullstop.t
blob: f2e91101e0f3fd962efd9577f9efad4fd71d54b4 (plain)
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
# Testing hardening fullstop spaces
BEGIN {
    if($ENV{PERL_CORE}) {
        chdir 't';
        @INC = '../lib';
    }
}

use strict;
use Test;
BEGIN { plan tests => 11 };

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

print "# Hi, I'm ", __FILE__, "\n";
ok 1;

use Pod::Simple;
use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";
sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }

&ok( e "", "" );
&ok( e "\n", "", );

die unless ok !! Pod::Simple::XMLOutStream->can('fullstop_space_harden');
sub harden { $_[0]->fullstop_space_harden(1) }

print "# Test that \".  \" always compacts without the hardening on...\n";

ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D.  I\ncalled back!\n"),
  qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
);
ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D. I called back!\n"),
  qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
);
ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\nShe set me a message about the M.D.\nI called back!\n"),
  qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
);


print "# Now testing with the hardening on...\n";

ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D.  I\ncalled back!\n"),
  qq{<Document><Para>She set me a message about the M.D.&#160; I called back!</Para></Document>}
);
ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D. I called back!\n"),
  qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
);
ok( Pod::Simple::XMLOutStream->_out(\&harden, "\n=pod\n\nShe set me a message about the M.D.\nI called back!\n"),
  qq{<Document><Para>She set me a message about the M.D. I called back!</Para></Document>}
);


print "# Byebye\n";
ok 1;