Improve and restructure t/op/pat.t and split out some unicode related tests into...
[p5sagit/p5-mst-13.2.git] / t / op / my.t
index 601e1d6..6a477db 100755 (executable)
--- a/t/op/my.t
+++ b/t/op/my.t
@@ -1,8 +1,6 @@
 #!./perl
 
-# $RCSfile: my.t,v $
-
-print "1..31\n";
+print "1..36\n";
 
 sub foo {
     my($a, $b) = @_;
@@ -99,3 +97,36 @@ for my $full (keys %fonts) {
     # Supposed to be copy-on-write via force_normal after a THINKFIRST check.
     print "$full $fonts{nok}\n";
 }
+
+#  [perl #29340] optimising away the = () left the padav returning the
+# array rather than the contents, leading to 'Bizarre copy of array' error
+
+sub opta { my @a=() }
+sub opth { my %h=() }
+eval { my $x = opta };
+print "not " if $@;
+print "ok 32\n";
+eval { my $x = opth };
+print "not " if $@;
+print "ok 33\n";
+
+
+sub foo3 {
+    ++my $x->{foo};
+    print "not " if defined $x->{bar};
+    ++$x->{bar};
+}
+eval { foo3(); foo3(); };
+print "not " if $@;
+print "ok 34\n";
+
+# my $foo = undef should always assign [perl #37776]
+{
+    my $count = 35;
+    loop:
+    my $test = undef;
+    print "not " if defined $test;
+    print "ok $count\n";
+    $test = 42;
+    goto loop if ++$count < 37;
+}