This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor podcheck.t to slurp files into scalars, instead of an array of lines.
[perl5.git] / t / io / perlio_leaks.t
1 #!perl
2 # ioleaks.t
3
4 BEGIN {
5     chdir 't' if -d 't';
6     @INC = '../lib';
7     require './test.pl';
8 }
9
10 use strict;
11 use warnings;
12 plan 'no_plan';
13
14 # :unix   -> not ok
15 # :stdio  -> not ok
16 # :perlio -> ok
17 # :crlf   -> ok
18
19 TODO: {
20     foreach my $layer(qw(:unix :stdio  :perlio :crlf)){
21         my $base_fd = do{ open my $in, '<', $0 or die $!; fileno $in };
22
23         for(1 .. 3){
24             local $::TODO;
25             if ($_ > 1 && $layer =~ /^:(unix|stdio)$/) {
26                 $::TODO = "[perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio"
27             }
28             open my $fh, "<$layer", $0 or die $!;
29
30             is fileno($fh), $base_fd, $layer;
31             binmode $fh, ':pop';
32         }
33     }
34 }
35