Commit | Line | Data |
---|---|---|
099be4f1 DM |
1 | #!./perl |
2 | # | |
3 | # tests for default output handle | |
4 | ||
5 | # DAPM 30/4/10 this area seems to have been undertested. For now, the only | |
6 | # tests are ensuring things don't crash when PL_defoutgv isn't a GV; | |
7 | # it probably needs expanding at some point to cover other stuff. | |
8 | ||
9 | BEGIN { | |
10 | chdir 't'; | |
11 | @INC = '../lib'; | |
12 | require './test.pl'; | |
13 | } | |
14 | ||
15 | plan tests => 16; | |
16 | ||
17 | ||
18 | my $stderr = *STDERR; | |
19 | select($stderr); | |
20 | $stderr = 1; # whoops, PL_defoutgv no longer a GV! | |
21 | ||
22 | # note that in the tests below, the return values aren't as important | |
23 | # as the fact that they don't crash | |
24 | ||
25 | ok !print(""), 'print'; | |
26 | ok !select(), 'select'; | |
27 | $a = 'fooo'; | |
28 | format STDERR = | |
29 | #@<< | |
30 | $a; | |
31 | . | |
32 | ok ! write(), 'write'; | |
33 | ||
34 | is($^, "", '$^'); | |
35 | is($~, "", '$~'); | |
36 | is($=, undef, '$='); | |
37 | is($-, undef, '$-'); | |
38 | is($%, undef, '$%'); | |
39 | is($|, 0, '$|'); | |
40 | $^ = 1; pass '$^ = 1'; | |
41 | $~ = 1; pass '$~ = 1'; | |
42 | $= = 1; pass '$= = 1'; | |
43 | $- = 1; pass '$- = 1'; | |
44 | $% = 1; pass '$% = 1'; | |
45 | $| = 1; pass '$| = 1'; | |
46 | ok !close(), 'close'; | |
47 |