File: binmode.t

package info (click to toggle)
libpandoc-wrapper-perl 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 589; makefile: 5; sh: 1
file content (26 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use Test::More;
use Pandoc;

use utf8; # essential!

sub capture_stderr(&;@);

plan skip_all => 'pandoc executable required' unless pandoc;
plan skip_all => 'Capture::Tiny required'
    unless eval 'use Capture::Tiny qw(capture_stderr); 1;';

my $input = <<'DUMMY_TEXT';
## Ëïüs Üt

Qüï äüt völüptätë mïnïmä.
DUMMY_TEXT
my( $output, $stderr );

$stderr = capture_stderr { pandoc->run( +{ in => \$input, out => \$output } ) };
unlike  $stderr, qr{Wide character in print}, 'no wide character warning';

$stderr = capture_stderr { pandoc->run( +{ in => \$input, out => \$output, binmode => ':encoding(UTF-8)' } ) };
unlike  $stderr, qr{Wide character in print}, 'one binmode for all handles';

done_testing;