1 BEGIN { # Magic Perl CORE pragma
2 unless (find PerlIO::Layer 'perlio') {
3 print "1..0 # Skip: PerlIO not used\n";
7 print "1..0 # Skip: EBCDIC\n";
13 use Test::More tests => 11;
15 BEGIN { use_ok('PerlIO::via::QuotedPrint') }
20 This is a tést for quoted-printable text that has hàrdly any speçial characters
25 This is a t=E9st for quoted-printable text that has h=E0rdly any spe=E7ial =
30 # Create the encoded test-file
33 open( my $out,'>:via(PerlIO::via::QuotedPrint)', $file ),
34 "opening '$file' for writing"
37 ok( (print $out $decoded), 'print to file' );
38 ok( close( $out ), 'closing encoding handle' );
40 # Check encoding without layers
44 ok( open( my $test,$file ), 'opening without layer' );
45 is( $encoded,readline( $test ), 'check encoded content' );
46 ok( close( $test ), 'close test handle' );
49 # Check decoding _with_ layers
52 open( my $in,'<:via(QuotedPrint)', $file ),
53 "opening '$file' for reading"
55 is( $decoded,join( '',<$in> ), 'check decoding' );
56 ok( close( $in ), 'close decoding handle' );
58 # Remove whatever we created now
60 ok( unlink( $file ), "remove test file '$file'" );
61 1 while unlink $file; # multiversioned filesystems