diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-11 22:32:06 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-11 22:32:06 +0000 |
commit | 467298a34215401cdcbb1dded51bc2aba5f1f41c (patch) | |
tree | 1923f32fbc9cf8f0b4ab291d1eb9fad5ab872d68 /t/manifypods_with_utf8.t | |
download | Module-Build-tarball-master.tar.gz |
Module-Build-0.4214HEADModule-Build-0.4214master
Diffstat (limited to 't/manifypods_with_utf8.t')
-rw-r--r-- | t/manifypods_with_utf8.t | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/t/manifypods_with_utf8.t b/t/manifypods_with_utf8.t new file mode 100644 index 0000000..ebb0db6 --- /dev/null +++ b/t/manifypods_with_utf8.t @@ -0,0 +1,68 @@ +package ManifypodsWithUtf8; +use strict; +use utf8; +use Test::More; + +use lib 't/lib'; +blib_load('Module::Build'); +blib_load('Module::Build::ConfigData'); + +SKIP: { + unless ( Module::Build::ConfigData->feature('manpage_support') ) { + skip 'manpage_support feature is not enabled'; + } +} + +use MBTest tests => 2; +use File::Spec::Functions qw( catdir ); + +use Cwd (); +my $cwd = Cwd::cwd; +my $tmp = MBTest->tmpdir; + +use DistGen; +my $dist = DistGen->new( dir => $tmp ); +my $content = <<'---'; + +=encoding utf8 + +=head1 NAME + +Simple::PodWithUtf8 - POD with some (ç á à ô) special chars + +=cut +--- +utf8::encode($content); +$dist->add_file( 'lib/Simple/PodWithUtf8.pod', $content); +$dist->regen; +$dist->chdir_in; + +my $destdir = catdir($cwd, 't', 'install_test' . $$); + +my $mb = Module::Build->new( + module_name => $dist->name, + install_base => $destdir, + + # need default install paths to ensure manpages get generated + installdirs => 'site', + config => { + installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'), + installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'), + }, + extra_manify_args => { utf8 => 1 }, + ); +$mb->add_to_cleanup($destdir); + + +$mb->dispatch('build'); +my $sep = $mb->manpage_separator; +my $ext3 = $mb->config('man3ext'); +my $to = File::Spec->catfile('blib', 'libdoc', "Simple${sep}PodWithUtf8.${ext3}"); + +ok(-e $to, "Manpage is found at $to"); +open my $pod, '<:encoding(utf-8)', $to or diag "Could not open $to: $!"; +my $pod_content = do { local $/; <$pod> }; +close $pod; + +like($pod_content, qr/ \(ç á à ô\) /, "POD should contain special characters"); + |