Blame t/09-preserve-exit-code.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/next_fd sig_num/;
|
|
Packit Service |
44c065 |
use Capture::Tiny qw/capture/;
|
|
Packit Service |
44c065 |
use Config;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
plan tests => 2;
|
|
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 |
|
|
Packit Service |
44c065 |
my $fd = next_fd;
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
capture {
|
|
Packit Service |
44c065 |
$? = 42;
|
|
Packit Service |
44c065 |
};
|
|
Packit Service |
44c065 |
is( $?, 42, "\$\? preserved after capture ends" );
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
is( next_fd, $fd, "no file descriptors leaked" );
|
|
Packit Service |
44c065 |
|
|
Packit Service |
44c065 |
exit 0;
|
|
Packit Service |
44c065 |
|