Login
RT #79289: False Postive in Perl::Critic::Utils::is_in_void_context()
[gknop/Perl-Critic.git] / t / BuiltinFunctions / ProhibitVoidMap.run
CommitLineData
6977a06e
ES
1## name Basic passing
2## failures 0
3## cut
4
5$baz, map "$foo", @list;
6print map("$foo", @list);
7print ( map "$foo", @list );
8@list = ( map $foo, @list );
9$aref = [ map $foo, @list ];
10$href = { map $foo, @list };
11
12if( map { foo($_) } @list ) {}
13for( map { foo($_) } @list ) {}
14
15#-----------------------------------------------------------------------------
16
17## name Basic failure
18## failures 7
19## cut
20
21map "$foo", @list;
22map("$foo", @list);
23map { foo($_) } @list;
24map({ foo($_) } @list);
25
26if( $condition ){ map { foo($_) } @list }
27while( $condition ){ map { foo($_) } @list }
28for( @list ){ map { foo($_) } @list }
29
30#-----------------------------------------------------------------------------
31
32## name Chained void map
33## failures 1
34## cut
35
36map { foo($_) }
37 map { bar($_) }
38 map { baz($_) } @list;
39
40#-----------------------------------------------------------------------------
41
96c297de
CD
42## name not builtin map
43## failures 0
44## cut
45
46$self->map('Pennsylvania Ave, Washington, DC');
47
48#-----------------------------------------------------------------------------
49
b946a486
TW
50## name Subscript map (derived from RT #79289)
51## failures 0
52## cut
53
54my %hash;
55
56delete @hash{ map { uc $_ } keys %hash };
57delete @hash{ map uc( $_ ), keys %hash };
58# This is the form analogous to what failed under RT #79289.
59delete @hash{ map ( uc( $_ ), keys %hash ) };
60
61#-----------------------------------------------------------------------------
62
6977a06e
ES
63##############################################################################
64# $URL$
65# $Date$
66# $Author$
67# $Revision$
68##############################################################################
69
70# Local Variables:
71# mode: cperl
72# cperl-indent-level: 4
73# fill-column: 78
74# indent-tabs-mode: nil
75# c-indentation-style: bsd
76# End:
96fed375 77# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :