Debian lenny version packages
[pkg-perl] / deb-src / libpod-simple-perl / libpod-simple-perl-3.07 / t / tiedfh.t
1 # Testing tied output filehandle
2 BEGIN {
3     if($ENV{PERL_CORE}) {
4         chdir 't';
5         @INC = '../lib';
6     }
7 }
8
9 use strict;
10 use Test;
11 BEGIN { plan tests => 8 };
12
13 use Pod::Simple::TiedOutFH;
14 ok 1;
15
16 print "# Sanity test of Perl and Pod::Simple::TiedOutFH\n";
17
18 {
19   my $x = 'abc';
20   my $out = Pod::Simple::TiedOutFH->handle_on($x);
21   print $out "Puppies\n";
22   print $out "rrrrr";
23   print $out "uffuff!";
24   ok $x, "abcPuppies\nrrrrruffuff!";
25   undef $out;
26   ok $x, "abcPuppies\nrrrrruffuff!";
27 }
28
29 # Now test that we can have two different strings.
30 {
31   my $x1 = 'abc';
32   my $x2 = 'xyz';
33   my $out1 = Pod::Simple::TiedOutFH->handle_on($x1);
34   my $out2 = Pod::Simple::TiedOutFH->handle_on($x2);
35
36   print $out1 "Puppies\n";
37   print $out2 "Kitties\n";
38   print $out2 "mmmmm";
39   print $out1 "rrrrr";
40   print $out2 "iaooowwlllllllrrr!\n";
41   print $out1 "uffuff!";
42
43   ok $x1, "abcPuppies\nrrrrruffuff!",              "out1 test";
44   ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test";
45
46   undef $out1;
47   undef $out2;
48
49   ok $x1, "abcPuppies\nrrrrruffuff!",              "out1 test";
50   ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test";
51 }
52
53
54 print "# Wrapping up... one for the road...\n";
55 ok 1;
56 print "# --- Done with ", __FILE__, " --- \n";
57
58