3 # text-encoding.t -- Test Pod::Text with various weird encoding combinations.
5 # Copyright 2002, 2004, 2006, 2007, 2008, 2009
6 # Russ Allbery <rra@stanford.edu>
8 # This program is free software; you may redistribute it and/or modify it
9 # under the same terms as Perl itself.
13 if ($ENV{PERL_CORE}) {
16 unshift (@INC, '../blib/lib');
24 # UTF-8 support requires Perl 5.8 or later.
27 plan skip_all => 'Perl 5.8 required for encoding support';
32 BEGIN { use_ok ('Pod::Text') }
34 eval { binmode (\*DATA, ':raw') };
35 eval { binmode (\*STDOUT, ':raw') };
36 my $builder = Test::More->builder;
37 eval { binmode ($builder->output, ':raw') };
38 eval { binmode ($builder->failure_output, ':raw') };
43 $opts{utf8} = 1 if $n == 3;
44 next until $_ eq "###\n";
45 my $parser = Pod::Text->new (%opts);
46 isa_ok ($parser, 'Pod::Text', 'Parser object');
47 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
48 eval { binmode (\*TMP, ':raw') };
50 last if $_ eq "###\n";
54 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
55 eval { binmode (\*OUT, ':raw') };
56 $parser->parse_from_file ('tmp.pod', \*OUT);
58 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
59 eval { binmode (\*TMP, ':raw') };
66 1 while unlink ('tmp.pod', 'out.tmp');
69 last if $_ eq "###\n";
72 is ($output, $expected, "Output correct for test $n");
76 # Below the marker are bits of POD and corresponding expected text output.
77 # This is used to test specific features or problems with Pod::Text. The
78 # input and output are separated by lines containing only ###.
83 =head1 Test of SE<lt>E<gt>
85 This is S<some whitespace>.
88 This is some whitespace.
95 =head1 I can eat glass
101 Mi povas manÄ
\9di vitron, Ä
\9di ne damaÄ
\9das min.
105 â
\8aâ
\80â
\89â
\81â
\9dâ
\80â
\91â
\81â
\9eâ
\80â
\9bâ
\87â
\81â
\8eâ
\8eâ
\80â
\81â
\9dâ
\99â
\80â
\8aâ
\9eâ
\80â
\99â
\95â
\91â
\8eâ
\9dâ
\9eâ
\80â
\93â ¥â
\97â
\9eâ
\80â
\8dâ
\91
109 मà¥
\88à¤
\82 à¤
\95ाà¤
\81à¤
\9a à¤
\96ा सà¤
\95ता हà¥
\82à¤
\81 à¤
\94र मà¥
\81à¤
\9dà¥
\87 à¤
\89ससà¥
\87 à¤
\95à¥
\8bà¤
\88 à¤
\9aà¥
\8bà¤
\9f नहà¥
\80à¤
\82 पहà¥
\81à¤
\82à¤
\9aतà¥
\80.
113 See L<http://www.columbia.edu/kermit/utf8.html>
117 Mi povas manÄ
\9di vitron, Ä
\9di ne damaÄ
\9das min.
120 â
\8aâ
\80â
\89â
\81â
\9dâ
\80â
\91â
\81â
\9eâ
\80â
\9bâ
\87â
\81â
\8eâ
\8eâ
\80â
\81â
\9dâ
\99â
\80â
\8aâ
\9eâ
121 \80â
\99â
\95â
\91â
\8eâ
\9dâ
\9eâ
\80â
\93â ¥â
\97â
\9eâ
\80â
\8dâ
\91
124 मà¥
\88à¤
\82 à¤
\95ाà¤
\81à¤
\9a à¤
\96ा सà¤
\95ता हà¥
\82à¤
\81 à¤
\94र
125 मà¥
\81à¤
\9dà¥
\87 à¤
\89ससà¥
\87 à¤
\95à¥
\8bà¤
\88 à¤
\9aà¥
\8bà¤
\9f नहà¥
\80à¤
\82
126 पहà¥
\81à¤
\82à¤
\9aतà¥
\80.
128 See <http://www.columbia.edu/kermit/utf8.html>