This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move Pod::Simple from lib to ext.
[perl5.git] / ext / Pod-Simple / t / tiedfh.t
CommitLineData
351625bd
SP
1BEGIN {
2 if($ENV{PERL_CORE}) {
3 chdir 't';
4 @INC = '../lib';
5 }
6}
7
8use strict;
9use Test;
10BEGIN { plan tests => 8 };
11
12use Pod::Simple::TiedOutFH;
13ok 1;
14
15print "# Sanity test of Perl and Pod::Simple::TiedOutFH\n";
16
17{
18 my $x = 'abc';
19 my $out = Pod::Simple::TiedOutFH->handle_on($x);
20 print $out "Puppies\n";
21 print $out "rrrrr";
22 print $out "uffuff!";
23 ok $x, "abcPuppies\nrrrrruffuff!";
24 undef $out;
25 ok $x, "abcPuppies\nrrrrruffuff!";
26}
27
28# Now test that we can have two different strings.
29{
30 my $x1 = 'abc';
31 my $x2 = 'xyz';
32 my $out1 = Pod::Simple::TiedOutFH->handle_on($x1);
33 my $out2 = Pod::Simple::TiedOutFH->handle_on($x2);
34
35 print $out1 "Puppies\n";
36 print $out2 "Kitties\n";
37 print $out2 "mmmmm";
38 print $out1 "rrrrr";
39 print $out2 "iaooowwlllllllrrr!\n";
40 print $out1 "uffuff!";
41
42 ok $x1, "abcPuppies\nrrrrruffuff!", "out1 test";
43 ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test";
44
45 undef $out1;
46 undef $out2;
47
48 ok $x1, "abcPuppies\nrrrrruffuff!", "out1 test";
49 ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test";
50}
51
52
53print "# Wrapping up... one for the road...\n";
54ok 1;
55print "# --- Done with ", __FILE__, " --- \n";
56
57