Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libpod-coverage-perl / libpod-coverage-perl-0.19 / t / 03import.t
1 #!/usr/bin/perl -w
2 use strict;
3 use lib 't/lib';
4 use Test::More tests => 3;
5
6
7 is( capture(q{ use Pod::Coverage package => 'Simple2'; }), "Simple2 has a Pod::Coverage rating of 0.75\n'naked' is uncovered", "Simple2 works correctly in import form");
8
9 is( capture(q{ use Pod::Coverage package => 'Simple7' }), "Simple7 has a Pod::Coverage rating of 0\nThe following are uncovered: bar, foo", 'Simple7 import form');
10
11 is( capture(q{ use Pod::Coverage 'Simple7' }), "Simple7 has a Pod::Coverage rating of 0\nThe following are uncovered: bar, foo", 'Simple7 import form, implicit package');
12
13 sub capture {
14     my $code = shift;
15     open(FH, ">test.out") or die "Couldn't open test.out for writing: $!";
16     open(OLDOUT, ">&STDOUT");
17     select(select(OLDOUT));
18     open(STDOUT, ">&FH");
19
20     eval $code;
21
22     close STDOUT;
23     close FH;
24     open(STDOUT, ">&OLDOUT");
25     open(FH, "<test.out") or die "Couldn't open test.out for reading: $!";
26     my $result;
27     { local $/; $result = <FH>; }
28     chomp $result;
29     close FH;
30     unlink('test.out');
31     return $result;
32 }