Commit | Line | Data |
---|---|---|
351625bd SP |
1 | BEGIN { |
2 | if($ENV{PERL_CORE}) { | |
3 | chdir 't'; | |
4 | @INC = '../lib'; | |
5 | } | |
6 | } | |
7 | ||
8 | use strict; | |
9 | use Test; | |
10 | BEGIN { plan tests => 8 }; | |
11 | ||
12 | use Pod::Simple::TiedOutFH; | |
13 | ok 1; | |
14 | ||
15 | print "# 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 | ||
53 | print "# Wrapping up... one for the road...\n"; | |
54 | ok 1; | |
55 | print "# --- Done with ", __FILE__, " --- \n"; | |
56 | ||
57 |