use strict;
use warnings;
-use Test::More tests => 112;
+use Test::More tests => 109;
# 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
ok($ok, '((1 == $ok || undef) // "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
{ # A helper class to count the number of accesses.