aboutsummaryrefslogtreecommitdiff
path: root/contrib/perl5/t/op/gv.t
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2000-06-25 11:04:01 +0000
committerMark Murray <markm@FreeBSD.org>2000-06-25 11:04:01 +0000
commit5bd17c648f0bbb4ad71945d610980dae7c796874 (patch)
tree27e7479daa33fdd2e21c9511b9eaeef4bd9d5b51 /contrib/perl5/t/op/gv.t
parent2c00ff843494c9d436d48007c3cdf9c7500976a8 (diff)
parent120a02d4f3990e59fba1df18a155ff7233b4d827 (diff)
This commit was generated by cvs2svn to compensate for changes in r62076,
which included commits to RCS files with non-trunk default branches.
Notes
Notes: svn path=/head/; revision=62077
Diffstat (limited to 'contrib/perl5/t/op/gv.t')
-rwxr-xr-xcontrib/perl5/t/op/gv.t48
1 files changed, 45 insertions, 3 deletions
diff --git a/contrib/perl5/t/op/gv.t b/contrib/perl5/t/op/gv.t
index c253e4bd9d57..04905cd40099 100755
--- a/contrib/perl5/t/op/gv.t
+++ b/contrib/perl5/t/op/gv.t
@@ -4,7 +4,14 @@
# various typeglob tests
#
-print "1..23\n";
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
+
+use warnings;
+
+print "1..30\n";
# type coersion on assignment
$foo = 'foo';
@@ -62,7 +69,7 @@ if (defined $baa) {
# fact that %X::Y:: is stored in %X:: isn't documented.
# (I hope.)
-{ package Foo::Bar }
+{ package Foo::Bar; no warnings 'once'; $test=1; }
print exists $Foo::{'Bar::'} ? "ok 12\n" : "not ok 12\n";
print $Foo::{'Bar::'} eq '*Foo::Bar::' ? "ok 13\n" : "not ok 13\n";
@@ -77,7 +84,7 @@ print +($foo || @foo || %foo) ? "not ok" : "ok", " 14\n";
{
my $msg;
local $SIG{__WARN__} = sub { $msg = $_[0] };
- local $^W = 1;
+ use warnings;
*foo = 'bar';
print $msg ? "not ok" : "ok", " 15\n";
*foo = undef;
@@ -95,4 +102,39 @@ print *{*x{GLOB}} eq "*main::STDOUT" ? "ok 21\n" : "not ok 21\n";
print {*x{IO}} "ok 22\n";
print {*x{FILEHANDLE}} "ok 23\n";
+# test if defined() doesn't create any new symbols
+
+{
+ my $test = 23;
+
+ my $a = "SYM000";
+ print "not " if defined *{$a};
+ ++$test; print "ok $test\n";
+
+ print "not " if defined @{$a} or defined *{$a};
+ ++$test; print "ok $test\n";
+
+ print "not " if defined %{$a} or defined *{$a};
+ ++$test; print "ok $test\n";
+
+ print "not " if defined ${$a} or defined *{$a};
+ ++$test; print "ok $test\n";
+
+ print "not " if defined &{$a} or defined *{$a};
+ ++$test; print "ok $test\n";
+
+ *{$a} = sub { print "ok $test\n" };
+ print "not " unless defined &{$a} and defined *{$a};
+ ++$test; &{$a};
+}
+
+# does pp_readline() handle glob-ness correctly?
+
+{
+ my $g = *foo;
+ $g = <DATA>;
+ print $g;
+}
+__END__
+ok 30