Skip to content

Commit 559ef07

Browse files
committed
Actually handle utf8 correctly in utf8-man tests
1 parent 054df9a commit 559ef07

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

t/manifypods_with_utf8.t

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ManifypodsWithUtf8;
22
use strict;
3+
use utf8;
34
use Test::More;
45

56
use lib 't/lib';
@@ -21,13 +22,18 @@ my $tmp = MBTest->tmpdir;
2122

2223
use DistGen;
2324
my $dist = DistGen->new( dir => $tmp );
24-
$dist->add_file( 'lib/Simple/PodWithUtf8.pod', <<'---' );
25+
my $content = <<'---';
26+
27+
=encoding utf8
28+
2529
=head1 NAME
2630
2731
Simple::PodWithUtf8 - POD with some (ç á à ô) special chars
2832
2933
=cut
3034
---
35+
utf8::encode($content);
36+
$dist->add_file( 'lib/Simple/PodWithUtf8.pod', $content);
3137
$dist->regen;
3238
$dist->chdir_in;
3339

@@ -49,9 +55,9 @@ my $sep = $mb->manpage_separator;
4955
my $ext3 = $mb->config('man3ext');
5056
my $to = File::Spec->catfile('blib', 'libdoc', "Simple${sep}PodWithUtf8.${ext3}");
5157

52-
open my $pod, '<:utf8', $to;
53-
undef $/; my $pod_content = <$pod>;
58+
open my $pod, '<:encoding(utf-8)', $to;
59+
my $pod_content = do { local $/; <$pod> };
5460
close $pod;
5561

56-
ok $pod_content =~ qr/ \(ç á à ô\) /, "POD should contain special characters";
62+
like($pod_content, qr/ \(ç á à ô\) /, "POD should contain special characters");
5763

0 commit comments

Comments
 (0)