Blame t/21-stderr-badtie.t
|
Packit Service |
44c065 |
# Copyright (c) 2009 by David Golden. All rights reserved.
|
|
Packit Service |
44c065 |
# Licensed under Apache License, Version 2.0 (the "License").
|
|
Packit Service |
44c065 |
# You may not use this file except in compliance with the License.
|
|
Packit Service |
44c065 |
# A copy of the License was distributed with this file or you may obtain a
|
|
Packit Service |
44c065 |
# copy of the License from http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
use strict;
|
|
Packit Service |
44c065 |
use warnings;
|
|
Packit Service |
44c065 |
use Test::More;
|
|
Packit Service |
44c065 |
use lib 't/lib';
|
|
Packit Service |
44c065 |
use Utils qw/save_std restore_std next_fd/;
|
|
Packit Service |
44c065 |
use Cases qw/run_test/;
|
|
Packit Service |
44c065 |
use TieEvil;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
use Config;
|
|
Packit Service |
44c065 |
my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
plan skip_all => "capture needs Perl 5.8 for tied STDERR"
|
|
Packit Service |
44c065 |
if $] < 5.008;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
plan 'no_plan';
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
my $builder = Test::More->builder;
|
|
Packit Service |
44c065 |
binmode($builder->failure_output, ':utf8') if $] >= 5.008;
|
|
Packit Service |
44c065 |
binmode($builder->todo_output, ':utf8') if $] >= 5.008;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
tie *STDERR, 'TieEvil';
|
|
Packit Service |
44c065 |
my $orig_tie = tied *STDERR;
|
|
Packit Service |
44c065 |
ok( $orig_tie, "STDERR is tied" );
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
my $fd = next_fd;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
run_test($_, '', 'skip_utf8') for qw(
|
|
Packit Service |
44c065 |
capture
|
|
Packit Service |
44c065 |
capture_scalar
|
|
Packit Service |
44c065 |
capture_stdout
|
|
Packit Service |
44c065 |
capture_stderr
|
|
Packit Service |
44c065 |
capture_merged
|
|
Packit Service |
44c065 |
);
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
if ( ! $no_fork ) {
|
|
Packit Service |
44c065 |
run_test($_, '', 'skip_utf8') for qw(
|
|
Packit Service |
44c065 |
tee
|
|
Packit Service |
44c065 |
tee_scalar
|
|
Packit Service |
44c065 |
tee_stdout
|
|
Packit Service |
44c065 |
tee_stderr
|
|
Packit Service |
44c065 |
tee_merged
|
|
Packit Service |
44c065 |
);
|
|
Packit Service |
44c065 |
}
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
is( next_fd, $fd, "no file descriptors leaked" );
|
|
Packit Service |
44c065 |
is( tied *STDERR, $orig_tie, "STDERR is still tied" );
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
exit 0;
|