Codebase list libcapture-tiny-perl / 6cf5491
check for fd leaks when stdin/out/err closed David Golden 15 years ago
3 changed file(s) with 18 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
77 use warnings;
88 use Test::More;
99 use Config;
10 use t::lib::Utils qw/save_std restore_std/;
10 use t::lib::Utils qw/save_std restore_std next_fd/;
1111 use t::lib::Tests qw(
1212 capture_tests capture_count
1313 capture_merged_tests capture_merged_count
1717
1818 #--------------------------------------------------------------------------#
1919
20 plan tests => 1 + capture_count() + capture_merged_count()
20 plan tests => 2 + capture_count() + capture_merged_count()
2121 + tee_count() + tee_merged_count();
2222
2323 my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
2626
2727 save_std(qw/stdout/);
2828 ok( close STDOUT, "closed STDOUT" );
29
30 my $fd = next_fd;
2931
3032 capture_tests();
3133 capture_merged_tests();
3638 tee_merged_tests();
3739 }
3840
41 is( next_fd, $fd, "no file descriptors leaked" );
42
3943 restore_std(qw/stdout/);
4044
77 use warnings;
88 use Test::More;
99 use Config;
10 use t::lib::Utils qw/save_std restore_std/;
10 use t::lib::Utils qw/save_std restore_std next_fd/;
1111 use t::lib::Tests qw(
1212 capture_tests capture_count
1313 capture_merged_tests capture_merged_count
1717
1818 #--------------------------------------------------------------------------#
1919
20 plan tests => 1 + capture_count() + capture_merged_count()
20 plan tests => 2 + capture_count() + capture_merged_count()
2121 + tee_count() + tee_merged_count();
2222
2323 my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
2626
2727 save_std(qw/stderr/);
2828 ok( close STDERR, "closed STDERR" );
29
30 my $fd = next_fd;
2931
3032 capture_tests();
3133 capture_merged_tests();
3638 tee_merged_tests();
3739 }
3840
41 is( next_fd, $fd, "no file descriptors leaked" );
42
3943 restore_std(qw/stderr/);
4044
77 use warnings;
88 use Test::More;
99 use Config;
10 use t::lib::Utils qw/save_std restore_std/;
10 use t::lib::Utils qw/save_std restore_std next_fd/;
1111 use t::lib::Tests qw(
1212 capture_tests capture_count
1313 capture_merged_tests capture_merged_count
1717
1818 #--------------------------------------------------------------------------#
1919
20 plan tests => 1 + capture_count() + capture_merged_count()
20 plan tests => 2 + capture_count() + capture_merged_count()
2121 + tee_count() + tee_merged_count();
2222
2323 my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
2626
2727 save_std(qw/stdin/);
2828 ok( close STDIN, "closed STDIN" );
29
30 my $fd = next_fd;
2931
3032 capture_tests();
3133 capture_merged_tests();
3638 tee_merged_tests();
3739 }
3840
41 is( next_fd, $fd, "no file descriptors leaked" );
42
3943 restore_std(qw/stdin/);
4044