1#!/usr/bin/perl -w 2# 3# Test Pod::Man UTF-8 handling, with and without PerlIO. 4# 5# Copyright 2002, 2004, 2006, 2008-2010, 2012, 2014-2015, 2018 6# Russ Allbery <rra@cpan.org> 7# 8# This program is free software; you may redistribute it and/or modify it 9# under the same terms as Perl itself. 10# 11# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl 12 13use 5.006; 14use strict; 15use warnings; 16 17use lib 't/lib'; 18 19use Test::More; 20use Test::Podlators qw(test_snippet_with_io); 21 22# UTF-8 support requires Perl 5.8 or later. 23BEGIN { 24 if ($] < 5.008) { 25 plan skip_all => 'Perl 5.8 required for UTF-8 support'; 26 } else { 27 plan tests => 13; 28 } 29} 30 31# Load the module. 32BEGIN { 33 use_ok('Pod::Man'); 34} 35 36# Force UTF-8 on all relevant file handles. Hide this in a string eval so 37# that older versions of Perl don't croak and minimum-version tests still 38# pass. 39# 40## no critic (BuiltinFunctions::ProhibitStringyEval) 41## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars) 42eval 'binmode(\*STDOUT, ":encoding(utf-8)")'; 43my $builder = Test::More->builder; 44eval 'binmode($builder->output, ":encoding(utf-8)")'; 45eval 'binmode($builder->failure_output, ":encoding(utf-8)")'; 46## use critic 47 48# For each of the UTF-8 snippets, check them with and without PerlIO layers. 49for my $snippet (qw(utf8-nonbreaking utf8-verbatim)) { 50 test_snippet_with_io('Pod::Man', "man/$snippet"); 51 test_snippet_with_io('Pod::Man', "man/$snippet", { perlio_utf8 => 1 }); 52} 53