This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lib/h2xs.t (was Re: [PATCH] h2xs)
[perl5.git] / lib / Symbol.t
CommitLineData
66deed98 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
66deed98 6}
7
8print "1..8\n";
9
10BEGIN { $_ = 'foo'; } # because Symbol used to clobber $_
11
12use Symbol;
13
14# First check $_ clobbering
15print "not " if $_ ne 'foo';
16print "ok 1\n";
17
18
19# First test gensym()
20$sym1 = gensym;
21print "not " if ref($sym1) ne 'GLOB';
22print "ok 2\n";
23
24$sym2 = gensym;
25
26print "not " if $sym1 eq $sym2;
27print "ok 3\n";
28
29ungensym $sym1;
30
31$sym1 = $sym2 = undef;
32
33
34# Test qualify()
35package foo;
36
37use Symbol qw(qualify); # must import into this package too
38
39qualify("x") eq "foo::x" or print "not ";
40print "ok 4\n";
41
42qualify("x", "FOO") eq "FOO::x" or print "not ";
43print "ok 5\n";
44
45qualify("BAR::x") eq "BAR::x" or print "not ";
46print "ok 6\n";
47
48qualify("STDOUT") eq "main::STDOUT" or print "not ";
49print "ok 7\n";
50
51qualify("ARGV", "FOO") eq "main::ARGV" or print "not ";
52print "ok 8\n";