diff options
author | brian d foy <unknown> | 2008-02-04 11:36:01 -0800 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2008-03-04 17:17:54 +0000 |
commit | 1dcb720a51504d7b20fb1eac689c4efad1376736 (patch) | |
tree | 4b9962d4d71ccc795221b9f58015b0f14e9d87bf | |
parent | 06494c4ce5c390b3232674707fe2e6e6218b50bc (diff) | |
download | perl-1dcb720a51504d7b20fb1eac689c4efad1376736.tar.gz |
[perl #50538] when( @n && %n ) fails to smart match
From: "brian d foy" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-4355-1202182561-1550.50538-75-0@perl.org>
Updated tests in ticket to become TODO tests
p4raw-id: //depot/perl@33434
-rw-r--r-- | t/op/switch.t | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/t/op/switch.t b/t/op/switch.t index d897157946..352225847d 100644 --- a/t/op/switch.t +++ b/t/op/switch.t @@ -8,7 +8,7 @@ BEGIN { use strict; use warnings; -use Test::More tests => 108; +use Test::More tests => 111; # The behaviour of the feature pragma should be tested by lib/switch.t # using the tests in t/lib/switch/*. This file tests the behaviour of @@ -519,6 +519,68 @@ sub bar {"bar"} ok($ok, '((1 == $ok) || "foo") smartmatched'); } +TODO: { + local $TODO = "RT #50538: when( \@n && \%n ) fails to smart match"; + { # this should smart match on each side of && + my @n = qw(fred barney betty); + my @m = @n; + + my $ok = 0; + given( "fred" ) { + when( @n ) { + $ok++; continue; + } + when( @m ) { + $ok++; continue; + } + when( @m && @n ) { + $ok++; + } + } + + is($ok, 3, '(@n && @m) smart-matched'); + } + + { # this should smart match on each side of && + my @n = qw(fred barney betty); + my %n = map { $_, 1 } @n; + + my $ok = 0; + given( "fred" ) { + when( @n ) { + $ok++; continue; + } + when( %n ) { + $ok++; continue; + } + when( @n && %n ) { + $ok++; + } + } + + is($ok, 3, '(@n && %n) smart-matched'); + } + + { # this should smart match on each side of && + my %n = map { $_, 1 } qw(fred barney betty); + my %m = %n; + + my $ok = 0; + given( "fred" ) { + when( %m ) { + $ok++; continue; + } + when( %n ) { + $ok++; continue; + } + when( %m && %n ) { + $ok++; + } + } + + is($ok, 3, '(%m && %n) smart-matched'); + } +} # Make sure we aren't invoking the get-magic more than once @@ -689,7 +751,7 @@ my $f = tie my $v, "FetchCounter"; q{Can't "break" in a loop topicalizer}); } when (1) { - is($first, 1, "Lecical loop: first"); + is($first, 1, "Lexical loop: first"); $first = 0; # Implicit break is okay } |