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 { | |
a817e89d | 10 | chdir 't' if -d 't'; |
099be4f1 | 11 | require './test.pl'; |
624c42e2 | 12 | set_up_inc('../lib'); |
099be4f1 DM |
13 | } |
14 | ||
470e8f06 KW |
15 | $|=0; # test.pl makes it 1, and that conflicts with the below. |
16 | ||
8ff33955 FC |
17 | plan tests => 16; |
18 | ||
099be4f1 | 19 | |
53b7400f FC |
20 | my $stdout = *STDOUT; |
21 | select($stdout); | |
22 | $stdout = 1; # whoops, PL_defoutgv no longer a GV! | |
2acc3314 | 23 | # XXX It is a GV as of 5.13.7. Is this test file needed any more? |
099be4f1 DM |
24 | |
25 | # note that in the tests below, the return values aren't as important | |
26 | # as the fact that they don't crash | |
27 | ||
2acc3314 FC |
28 | ok print(""), 'print'; |
29 | ok select(), 'select'; | |
021897e0 | 30 | |
8ff33955 | 31 | $a = 'fooo'; |
53b7400f | 32 | format STDOUT = |
021897e0 JH |
33 | @ @<< |
34 | "#", $a | |
099be4f1 | 35 | . |
021897e0 | 36 | ok((write())[0], 'write'); |
099be4f1 | 37 | |
2acc3314 FC |
38 | ok($^, '$^'); |
39 | ok($~, '$~'); | |
40 | ok($=, '$='); | |
41 | ok($-, '$-'); | |
42 | is($%, 0, '$%'); | |
099be4f1 DM |
43 | is($|, 0, '$|'); |
44 | $^ = 1; pass '$^ = 1'; | |
45 | $~ = 1; pass '$~ = 1'; | |
46 | $= = 1; pass '$= = 1'; | |
47 | $- = 1; pass '$- = 1'; | |
48 | $% = 1; pass '$% = 1'; | |
49 | $| = 1; pass '$| = 1'; | |
099be4f1 | 50 | |
53b7400f FC |
51 | # Switch to STDERR for this test, so we do not lose our test output |
52 | my $stderr = *STDERR; | |
53 | select($stderr); | |
54 | $stderr = 1; | |
55 | ok close(), 'close'; |