This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/gv.t working under minitest
[perl5.git] / t / io / defout.t
CommitLineData
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
9BEGIN {
10 chdir 't';
11 @INC = '../lib';
12 require './test.pl';
13}
14
8ff33955
FC
15plan tests => 16;
16
099be4f1 17
53b7400f
FC
18my $stdout = *STDOUT;
19select($stdout);
20$stdout = 1; # whoops, PL_defoutgv no longer a GV!
2acc3314 21# XXX It is a GV as of 5.13.7. Is this test file needed any more?
099be4f1
DM
22
23# note that in the tests below, the return values aren't as important
24# as the fact that they don't crash
25
2acc3314
FC
26ok print(""), 'print';
27ok select(), 'select';
021897e0 28
8ff33955 29$a = 'fooo';
53b7400f 30format STDOUT =
021897e0
JH
31@ @<<
32"#", $a
099be4f1 33.
021897e0 34ok((write())[0], 'write');
099be4f1 35
2acc3314
FC
36ok($^, '$^');
37ok($~, '$~');
38ok($=, '$=');
39ok($-, '$-');
40is($%, 0, '$%');
099be4f1
DM
41is($|, 0, '$|');
42$^ = 1; pass '$^ = 1';
43$~ = 1; pass '$~ = 1';
44$= = 1; pass '$= = 1';
45$- = 1; pass '$- = 1';
46$% = 1; pass '$% = 1';
47$| = 1; pass '$| = 1';
099be4f1 48
53b7400f
FC
49# Switch to STDERR for this test, so we do not lose our test output
50my $stderr = *STDERR;
51select($stderr);
52$stderr = 1;
53ok close(), 'close';