File: 03_2_Errorcheck_Stderr.t

package info (click to toggle)
libio-capture-perl 0.05-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 212 kB
  • sloc: perl: 207; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (5)
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
# vim600: set syn=perl :
use Test::More tests => 4;
BEGIN { use_ok('IO::Capture::Stderr') };

# These will generate some warnings -> preventing from printing
#open STDERR_SAV, ">&STDERR" 
open STDERR, ">/dev/null";

#Test 2
# Now test creating two captures of the same type and starting both
my $capture1 = IO::Capture::Stderr->new();
my $capture2 = IO::Capture::Stderr->new();

my $rv1 = $capture1->start();

ok(!$capture2->start(), "Two captures");

$capture2->stop();

ok(!$capture1->start(), "Two starts");

ok(!$capture1->read(), "Read before stop");

# restore STDERR
#close STDERR; open STDERR, ">&STDERR_SAV"; close STDERR_SAV;