forked from perl-pod/pod-simple
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This option allows the user to supply POD source that has already been decoded to Perl's internal character format
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# tell parser the source POD has already been decoded from bytes to chars | ||
# =encoding line should be ignored | ||
# utf8 characters should come through unscathed | ||
|
||
BEGIN { | ||
if($ENV{PERL_CORE}) { | ||
chdir 't'; | ||
@INC = '../lib'; | ||
} | ||
} | ||
|
||
use strict; | ||
use Test; | ||
BEGIN { plan tests => 3 }; | ||
|
||
use Pod::Simple::DumpAsXML; | ||
use Pod::Simple::XMLOutStream; | ||
|
||
|
||
my $parser = Pod::Simple::XMLOutStream->new; | ||
$parser->parse_characters(1); | ||
my $output = ''; | ||
$parser->output_string( \$output ); | ||
$parser->parse_string_document(qq{ | ||
=encoding bogocode | ||
=head1 DESCRIPTION | ||
Confirm that if we tell the parser to expect character data, it avoids all | ||
the code paths that might attempt to decode the source from bytes to chars. | ||
The r\x{101}in in \x{15E}pain \x{FB02}oods the plain | ||
}); | ||
|
||
ok(1); # parsed without exception | ||
|
||
if($output =~ /POD ERRORS/) { | ||
ok(0); | ||
} | ||
else { | ||
ok(1); # no errors | ||
} | ||
|
||
$output =~ s{&#(\d+);}{chr($1)}eg; | ||
|
||
if($output =~ /The r\x{101}in in \x{15E}pain \x{FB02}oods the plain/) { | ||
ok(1); # data was not messed up | ||
} | ||
else { | ||
ok(0); | ||
} | ||
|
||
|
||
|
||
warn $output; | ||
exit; |