summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-02-12 08:52:14 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-02-12 08:52:14 +0000
commita48abc44380b16821695ec705c8c8f3bfb09db6c (patch)
tree8b1b66a7ac8bccd992d7de4e3d7f7089cdc024ce /t
parent2ee0eb3cdf0bc0b8d47fbc6651740891de63e1b5 (diff)
parent9c79236d7175b8f41c4e17950788a40bc979aebb (diff)
downloadperl-a48abc44380b16821695ec705c8c8f3bfb09db6c.tar.gz
Integrate from mainperl.
p4raw-id: //depot/cfgperl@2886
Diffstat (limited to 't')
-rwxr-xr-xt/op/fh.t24
-rwxr-xr-xt/op/gv.t27
-rwxr-xr-xt/op/misc.t8
3 files changed, 57 insertions, 2 deletions
diff --git a/t/op/fh.t b/t/op/fh.t
new file mode 100755
index 0000000000..d2659c3b9a
--- /dev/null
+++ b/t/op/fh.t
@@ -0,0 +1,24 @@
+#!./perl
+
+print "1..5\n";
+
+my $test = 0;
+
+# symbolic filehandles should only result in glob entries with FH constructors
+
+my $a = "SYM000";
+print "not " if defined(fileno($a)) or defined *{$a};
+++$test; print "ok $test\n";
+
+select select $a;
+print "not " if defined *{$a};
+++$test; print "ok $test\n";
+
+print "not " if close $a or defined *{$a};
+++$test; print "ok $test\n";
+
+print "not " unless open($a, ">&STDOUT") and defined *{$a};
+++$test; print $a "ok $test\n";
+
+print "not " unless close $a;
+++$test; print $a "not "; print "ok $test\n";
diff --git a/t/op/gv.t b/t/op/gv.t
index c253e4bd9d..df4984e80c 100755
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -4,7 +4,7 @@
# various typeglob tests
#
-print "1..23\n";
+print "1..29\n";
# type coersion on assignment
$foo = 'foo';
@@ -95,4 +95,29 @@ 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};
+}
diff --git a/t/op/misc.t b/t/op/misc.t
index 9fe98c4589..57d57b7b37 100755
--- a/t/op/misc.t
+++ b/t/op/misc.t
@@ -411,7 +411,13 @@ destroyed
package X;
sub any { bless {} }
my $f = "FH000"; # just to thwart any future optimisations
-sub afh { select select ++$f; my $r = *{$f}{IO}; delete $X::{$f}; bless $r }
+sub afh {
+ open(++$f, '>&STDOUT') or die;
+ select select $f;
+ my $r = *{$f}{IO};
+ delete $X::{$f};
+ bless $r;
+}
sub DESTROY { print "destroyed\n" }
package main;
$x = any X; # to bump sv_objcount. IO objs aren't counted??