File: 09-preserve-exit-code.t

package info (click to toggle)
libcapture-tiny-perl 0.50-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 360 kB
  • sloc: perl: 852; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) 2009 by David Golden. All rights reserved.
# Licensed under Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License was distributed with this file or you may obtain a 
# copy of the License from http://www.apache.org/licenses/LICENSE-2.0

use strict;
use warnings;
use Test::More;
use lib 't/lib';
use Utils qw/next_fd sig_num/;
use Capture::Tiny qw/capture/;
use Config;

plan tests => 2;

my $builder = Test::More->builder;
binmode($builder->failure_output, ':utf8') if $] >= 5.008;

my $fd = next_fd;

capture {
  $? = 42;
};
is( $?, 42, "\$\? preserved after capture ends" );

is( next_fd, $fd, "no file descriptors leaked" );

exit 0;