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