perl 5.003_06: t/lib/symbol.t
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>
Mon, 30 Sep 1996 04:54:37 +0000 (00:54 -0400)
committerAndy Dougherty <doughera@lafcol.lafayette.edu>
Mon, 30 Sep 1996 04:54:37 +0000 (00:54 -0400)
Date: Sun, 22 Sep 1996 00:59:56 +0200
From: Gisle Aas <aas@aas.no>
Subject: More standard library test scripts

This is a collection of test scripts for the standard library modules.
Some of the tests does not pass unless some of the patches I have sent
out are applied.

Date: Mon, 30 Sep 1996 00:54:37 -0400
From: Spider Boardman <spider@Orb.Nashua.NH.US>

The various new lib/*.t tests didn't all work.  For some, it was
only because the count of tests was wrong:

t/lib/symbol.t [new file with mode: 0644]

diff --git a/t/lib/symbol.t b/t/lib/symbol.t
new file mode 100644 (file)
index 0000000..03449a3
--- /dev/null
@@ -0,0 +1,52 @@
+#!./perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+print "1..8\n";
+
+BEGIN { $_ = 'foo'; }  # because Symbol used to clobber $_
+
+use Symbol;
+
+# First check $_ clobbering
+print "not " if $_ ne 'foo';
+print "ok 1\n";
+
+
+# First test gensym()
+$sym1 = gensym;
+print "not " if ref($sym1) ne 'GLOB';
+print "ok 2\n";
+
+$sym2 = gensym;
+
+print "not " if $sym1 eq $sym2;
+print "ok 3\n";
+
+ungensym $sym1;
+
+$sym1 = $sym2 = undef;
+
+
+# Test qualify()
+package foo;
+
+use Symbol qw(qualify);  # must import into this package too
+
+qualify("x") eq "foo::x"          or print "not ";
+print "ok 4\n";
+
+qualify("x", "FOO") eq "FOO::x"   or print "not ";
+print "ok 5\n";
+
+qualify("BAR::x") eq "BAR::x"     or print "not ";
+print "ok 6\n";
+
+qualify("STDOUT") eq "main::STDOUT" or print "not ";
+print "ok 7\n";
+
+qualify("ARGV", "FOO") eq "main::ARGV" or print "not ";
+print "ok 8\n";