This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: make %n missing arg fatal
[perl5.git] / t / op / fh.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     require './test.pl';
6     set_up_inc('../lib');
7 }
8
9 plan tests => 8;
10
11 # symbolic filehandles should only result in glob entries with FH constructors
12
13 $|=1;
14 my $a = "SYM000";
15 ok(!defined(fileno($a)), 'initial file handle is undefined');
16 ok(!defined *{$a}, 'initial typeglob of file handle is undefined');
17
18 select select $a;
19 ok(defined *{$a}, 'typeglob of file handle defined after select');
20
21 $a++;
22 ok(!close $a, 'close does not succeed with incremented file handle');
23 ok(!defined *{$a}, 'typeglob of file handle not defined after increment');
24
25 ok(open($a, ">&STDOUT"), 'file handle used with open of standard output');
26 ok(defined *{$a}, 'typeglob of file handle defined after opening standard output');
27
28 ok(close $a, 'close standard output via file handle;');
29