3 # text-utf8.t -- Test Pod::Text with UTF-8 input.
5 # Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu>
7 # This program is free software; you may redistribute it and/or modify it
8 # under the same terms as Perl itself.
12 if ($ENV{PERL_CORE}) {
15 unshift (@INC, '../blib/lib');
17 unshift (@INC, '../blib/lib');
23 print "not ok 1\n" unless $loaded;
32 my $parser = Pod::Text->new or die "Cannot create parser\n";
34 eval { binmode (\*DATA, ':encoding(utf-8)') };
35 eval { binmode (\*STDOUT, ':encoding(utf-8)') };
37 next until $_ eq "###\n";
38 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
39 eval { binmode (\*TMP, ':encoding(utf-8)') };
40 print TMP "=encoding UTF-8\n\n";
42 last if $_ eq "###\n";
46 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
47 eval { binmode (\*OUT, ':encoding(utf-8)') };
48 $parser->parse_from_file ('tmp.pod', \*OUT);
50 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
51 eval { binmode (\*TMP, ':encoding(utf-8)') };
58 unlink ('tmp.pod', 'out.tmp');
61 last if $_ eq "###\n";
64 if ($output eq $expected) {
68 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
73 # Below the marker are bits of POD and corresponding expected text output.
74 # This is used to test specific features or problems with Pod::Text. The
75 # input and output are separated by lines containing only ###.
80 =head1 Test of SE<lt>E<gt>
82 This is S<some whitespace>.
85 This is some whitespace.
90 =head1 I can eat glass
96 Mi povas manĝi vitron, ĝi ne damaĝas min.
100 ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
104 मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती.
108 See L<http://www.columbia.edu/kermit/utf8.html>
112 Mi povas manĝi vitron, ĝi ne damaĝas min.
115 ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
118 मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती.
120 See <http://www.columbia.edu/kermit/utf8.html>