File: 04_3_Side-effects_Stderr.t

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

# Change SIG{__WARN__} to make sure it gets put back correctly
$SIG{__WARN__} = sub {print STDERR "Redirected message from warn(): @_\n"}; 
my $warn_save = $SIG{__WARN__};

#Test 2
ok (my $capture = IO::Capture->new(), "Constructor Test");

#Test 3
ok ($capture->start, "Start Method");
#Test 4
ok ($capture->stop, "Stop Method");


#########################################################
# Check WARN ############################################
#########################################################
#Test 5
my $test_result_5 = $SIG{__WARN__} eq $warn_save;
ok ($test_result_5, "Invariant Check - __WARN__");
diag "\n" . "*"x60 . "\n__WARN__ did not get restored correctly in $0\n" . "*"x60 . "\n\n" unless $test_result_5;