Add tests for the C<my $x if foo> deprecation, and change the
[p5sagit/p5-mst-13.2.git] / t / op / ref.t
index 9470efa..3bb280c 100755 (executable)
@@ -5,7 +5,7 @@ BEGIN {
     @INC = qw(. ../lib);
 }
 
-print "1..65\n";
+print "1..68\n";
 
 require 'test.pl';
 
@@ -200,14 +200,14 @@ foo WHATEVER "ok 38\n";
 # test the \(@foo) construct
 #
 package main;
-@foo = (1,2,3);
+@foo = \(1..3);
 @bar = \(@foo);
 @baz = \(1,@foo,@bar);
 print @bar == 3 ? "ok 39\n" : "not ok 39\n";
 print grep(ref($_), @bar) == 3 ? "ok 40\n" : "not ok 40\n";
 print @baz == 3 ? "ok 41\n" : "not ok 41\n";
 
-my(@fuu) = (1,2,3);
+my(@fuu) = \(1..2,3);
 my(@baa) = \(@fuu);
 my(@bzz) = \(1,@fuu,@baa);
 print @baa == 3 ? "ok 42\n" : "not ok 42\n";
@@ -340,6 +340,24 @@ if ($result eq $expect) {
   print "# expected \"$expect\", got \"$result\"\n";
 }
 
+# bug #21347
+
+runperl(prog => 'sub UNIVERSAL::AUTOLOAD { qr// } a->p' );
+if ($? != 0) { print "not " };
+print "ok ",++$test," - UNIVERSAL::AUTOLOAD called when freeing qr//\n";
+
+runperl(prog => 'sub UNIVERSAL::DESTROY { warn } bless \$a, A', stderr => 1);
+if ($? != 0) { print "not " };
+print "ok ",++$test," - warn called inside UNIVERSAL::DESTROY\n";
+
+
+# bug #22719
+
+runperl(prog => 'sub f { my $x = shift; *z = $x; } f({}); f();');
+if ($? != 0) { print "not " };
+print "ok ",++$test," - coredump on typeglob = (SvRV && !SvROK)\n";
+
+
 # test global destruction
 
 ++$test;