This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test case for C<undef %File::Glob::>
[perl5.git] / t / op / exists_sub.t
CommitLineData
afebc493
GS
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
afebc493
GS
6}
7
8print "1..9\n";
9
10sub t1;
11sub t2 : locked;
12sub t3 ();
13sub t4 ($);
14sub t5 {1;}
15{
16 package P1;
17 sub tmc {1;}
18 package P2;
19 @ISA = 'P1';
20}
21
22print "not " unless exists &t1 && not defined &t1;
23print "ok 1\n";
24print "not " unless exists &t2 && not defined &t2;
25print "ok 2\n";
26print "not " unless exists &t3 && not defined &t3;
27print "ok 3\n";
28print "not " unless exists &t4 && not defined &t4;
29print "ok 4\n";
30print "not " unless exists &t5 && defined &t5;
31print "ok 5\n";
32P2::->tmc;
33print "not " unless not exists &P2::tmc && not defined &P2::tmc;
34print "ok 6\n";
35my $ref;
36$ref->{A}[0] = \&t4;
37print "not " unless exists &{$ref->{A}[0]} && not defined &{$ref->{A}[0]};
38print "ok 7\n";
39undef &P1::tmc;
40print "not " unless exists &P1::tmc && not defined &P1::tmc;
41print "ok 8\n";
42eval 'exists &t5()';
43print "not " unless $@;
44print "ok 9\n";
45
46exit 0;