# Testing verbatim formatted sections use strict; use warnings; use Test::More tests => 60; #use Pod::Simple::Debug (6); use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; sub e { Pod::Simple::DumpAsXML->_duo(\&without_vf, @_) } sub ev { Pod::Simple::DumpAsXML->_duo(\&with_vf, @_) } sub with_vf { $_[0]-> accept_codes('VerbatimFormatted') } sub without_vf { $_[0]->unaccept_codes('VerbatimFormatted') } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ print "# Testing VerbatimFormatted...\n"; # A formatty line has to have #: in the first two columns, and uses # "^" to mean bold, "/" to mean underline, and "%" to mean bold italic. # Example: # What do you want? i like pie. [or whatever] # #:^^^^^^^^^^^^^^^^^ ///////////// &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// Hooboy. =cut }) => qq{ What do you want? i like pie. [or whatever]\n Hooboy.} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// Hooboy. =cut }) => qq{ What do you want? i like pie. [or whatever]\n Hooboy.} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// =cut }) => qq{ What do you want? i like pie. [or whatever]} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ //////////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///} ) => qq{ What do you want? i like pie. [or whatever]} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /// #:^^^^^^^^^^^^^^^^^ ///} ) => qq{ What do you want? i like pie. [or whatever]\n#:^^^^^^^^^^^^^^^^^ ///} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, # with a tab: q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /// } ) => qq{ What do you want? i like pie. [or whatever]} ); # Now testing the % too: &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ %%%% //////////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &is( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod Hooboy! What do you want? i like pie. [or whatever] #: ^^^^^ %%%% //////////////////} ) => qq{ Hooboy!\n What do you want? i like pie. [or whatever]} ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ print "# Now running some tests adapted from verbatims.t...\n#\n#\n"; print "# Without VerbatimFormatted...\n"; &is( e "", "" ); &is( e "\n", "", ); &is( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" ); &is( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" ); print "# With VerbatimFormatted...\n"; &is( ev "", "" ); &is( ev "\n", "", ); &is( ev "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" ); &is( ev "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" ); print "# Now testing via XMLOutStream without VerbatimFormatted...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n"), qq{ foo bar baz} ); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n quux\n"), qq{ foo bar baz\n quux} ); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\nquux\n"), qq{ foo bar baz\nquux} ); print "# Contiguous verbatims...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n quux\n"), qq{ foo bar baz\n\n quux} ); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n quux\n"), qq{ foo bar baz\n\n\n quux} ); print "# Testing =cut...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n quux\n"), qq{ foo bar baz} ); print "#\n# Now retesting with VerbatimFormatted...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n"), qq{ foo bar baz} ); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n quux\n"), qq{ foo bar baz\n quux} ); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\nquux\n"), qq{ foo bar baz\nquux} ); print "# Contiguous verbatims...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n quux\n"), qq{ foo bar baz\n\n quux} ); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n quux\n"), qq{ foo bar baz\n\n\n quux} ); print "# Testing =cut...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n quux\n"), qq{ foo bar baz} ); # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . { my $it = qq{ foo bar bazFoo quux\nquum} ; print "# Various \\n-(in)significance sanity checks...\n"; print "# verbatim/cut/head/verbatim sanity zero...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity one...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity two...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity three...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity four...\n"; is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); } # : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : print "#\n# Now retesting with VerbatimFormatted...\n"; { my $it = qq{ foo bar bazFoo quux\nquum} ; print "# Various \\n-(in)significance sanity checks...\n"; print "# verbatim/cut/head/verbatim sanity zero...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity one...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity two...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity three...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity four...\n"; is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); is( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); }