File: 01_3_Published_Methods_Stderr.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 (33 lines) | stat: -rw-r--r-- 1,127 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
# Published Methods 'Exist' Test
# vim600: set syn=perl :

use Test::More tests => 6;
BEGIN { use_ok('IO::Capture::Stderr') };

my $capture;

# Test 2
eval { $capture = IO::Capture::Stderr->new()};
ok(!$@, "Constructor Test");
print "Error checking 'new' constructor: $@\n" if $@;

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

eval {$capture->start};
ok(!$@, "Checking start method" );
print "\n" . "*" x 80 . qq/\nError checking published method, "start": $@\n/ . "*" x 80 . "\n" if $@;

eval {$capture->stop};
ok(!$@, "Checking stop method" );
print "\n" . "*" x 80 . qq/\nError checking published method, "stop": $@\n/ . "*" x 80 . "\n" if $@;

eval {$capture->read};
ok(!$@, "Checking read method" );
print "\n" . "*" x 80 . qq/\nError checking published method, "read": $@\n/ . "*" x 80 . "\n" if $@;

eval {$capture->line_pointer};
ok(!$@, "Checking line_pointer method" );
print "\n" . "*" x 80 . qq/\nError checking published method, "line_pointer": $@\n/ . "*" x 80 . "\n" if $@;

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