File: 03_1_Errorcheck_Stdout.t

package info (click to toggle)
libio-capture-perl 0.05-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 168 kB
  • ctags: 34
  • sloc: perl: 207; makefile: 44
file content (42 lines) | stat: -rw-r--r-- 899 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# vim600: set syn=perl :
use Test::More tests => 7;
BEGIN { use_ok('IO::Capture::Stdout') };

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

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

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

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

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

$capture2->stop();

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

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

$capture1->stop();

my $capture3 = IO::Capture::Stdout->new();

#Test 6
ok(!$capture3->stop(), "Stop before Start");

$capture3->start();
$capture3->stop();

#Test 7
ok(!$capture3->stop(), "Two Stops");

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