summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2003-05-06 10:58:27 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2003-05-06 10:58:27 +0000
commit2793b1da445b3d7a70c34cbaa951dbacdd7b2d3e (patch)
treedebd042615883ad69fd18c1fbcb48e99b85183fb /t
parent2b881ee74bf7aab1bea94d803004757f3ae0c571 (diff)
parent1aad1664cf756e015147414b107d6e07ef43c6bc (diff)
downloadperl-2793b1da445b3d7a70c34cbaa951dbacdd7b2d3e.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@19434
Diffstat (limited to 't')
-rw-r--r--t/lib/Devel/switchd.pm6
-rwxr-xr-xt/op/undef.t19
-rw-r--r--t/run/switchd.t2
3 files changed, 25 insertions, 2 deletions
diff --git a/t/lib/Devel/switchd.pm b/t/lib/Devel/switchd.pm
new file mode 100644
index 0000000000..4a657bef91
--- /dev/null
+++ b/t/lib/Devel/switchd.pm
@@ -0,0 +1,6 @@
+package Devel::switchd;
+use strict; BEGIN { } # use strict; BEGIN { ... } to incite [perl #21890]
+package DB;
+sub DB { print join(",", caller), ";" }
+1;
+
diff --git a/t/op/undef.t b/t/op/undef.t
index 1d169944be..04cac52fd6 100755
--- a/t/op/undef.t
+++ b/t/op/undef.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..28\n";
+print "1..36\n";
print defined($a) ? "not ok 1\n" : "ok 1\n";
@@ -85,3 +85,20 @@ print $@ =~ /^Modification of a read/ ? "ok 23\n" : "not ok 23\n";
eval 'undef tcp';
print $@ =~ /^Can't modify constant item/ ? "ok 28\n" : "not ok 28\n";
}
+
+# bugid 3096
+# undefing a hash may free objects with destructors that then try to
+# modify the hash. To them, the hash should appear empty.
+
+$test = 29;
+%hash = (
+ key1 => bless({}, 'X'),
+ key2 => bless({}, 'X'),
+);
+undef %hash;
+sub X::DESTROY {
+ print "not " if keys %hash; print "ok $test\n"; $test++;
+ print "not " if values %hash; print "ok $test\n"; $test++;
+ print "not " if each %hash; print "ok $test\n"; $test++;
+ print "not " if defined delete $hash{'key2'}; print "ok $test\n"; $test++;
+}
diff --git a/t/run/switchd.t b/t/run/switchd.t
index 83d4976b71..91efbef211 100644
--- a/t/run/switchd.t
+++ b/t/run/switchd.t
@@ -32,7 +32,7 @@ __SWDTEST__
push @tmpfiles, $filename;
$| = 1; # Unbufferize.
$r = runperl(
- switches => [ '-Ilib', '-d:DevelTest' ],
+ switches => [ '-Ilib', '-d:switchd' ],
progfile => $filename,
);
like($r, qr/^main,swdtest.tmp,9;Foo,swdtest.tmp,5;Foo,swdtest.tmp,6;Foo,swdtest.tmp,6;Bar,swdtest.tmp,2;Foo,swdtest.tmp,6;Bar,swdtest.tmp,2;Foo,swdtest.tmp,6;Bar,swdtest.tmp,2;Foo,swdtest.tmp,6;$/i);