This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
small wording fixes for perldelta
[perl5.git] / t / io / defout.t
... / ...
CommitLineData
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
9BEGIN {
10 chdir 't' if -d 't';
11 require './test.pl';
12 set_up_inc('../lib');
13}
14
15$|=0; # test.pl makes it 1, and that conflicts with the below.
16
17plan tests => 16;
18
19
20my $stdout = *STDOUT;
21select($stdout);
22$stdout = 1; # whoops, PL_defoutgv no longer a GV!
23# XXX It is a GV as of 5.13.7. Is this test file needed any more?
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
28ok print(""), 'print';
29ok select(), 'select';
30
31$a = 'fooo';
32format STDOUT =
33@ @<<
34"#", $a
35.
36ok((write())[0], 'write');
37
38ok($^, '$^');
39ok($~, '$~');
40ok($=, '$=');
41ok($-, '$-');
42is($%, 0, '$%');
43is($|, 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';
50
51# Switch to STDERR for this test, so we do not lose our test output
52my $stderr = *STDERR;
53select($stderr);
54$stderr = 1;
55ok close(), 'close';