X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fmy.t;h=6a477db2bf1fdf972993efdf8407f359ab00f42c;hb=6ec5370cb0aeb185d92b8fd2bad21bb10f75b30e;hp=d439bebd86b7a9344ac4195e1cb07f0e7987a362;hpb=cdaebead333273a920fe10cbcb2213a9fbefa241;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/my.t b/t/op/my.t old mode 100755 new mode 100644 index d439beb..6a477db --- a/t/op/my.t +++ b/t/op/my.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: my.t,v $ - -print "1..30\n"; +print "1..36\n"; sub foo { my($a, $b) = @_; @@ -10,7 +8,8 @@ sub foo { my $d; $c = "ok 3\n"; $d = "ok 4\n"; - { my($a,$c) = ("ok 9\n", "ok 10\n"); ($x, $y) = ($a, $c); } + { my($a, undef, $c) = ("ok 9\n", "not ok 10\n", "ok 10\n"); + ($x, $y) = ($a, $c); } print $a, $b; $c . $d; } @@ -91,3 +90,43 @@ print +(@x ? "not " : ""), "ok 29\n"; { @x = my %y } print +(@x ? "not " : ""), "ok 30\n"; +# Found in HTML::FormatPS +my %fonts = qw(nok 31); +for my $full (keys %fonts) { + $full =~ s/^n//; + # 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; +}