Login
Apply raw patch from Schwern that adds options to
[gknop/Perl-Critic.git] / t / RegularExpressions / RequireExtendedFormatting.run
CommitLineData
8b5a642f
CD
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8## name basic passes
196197a1
AL
9## failures 0
10## cut
11my $string =~ m{pattern}x;
12my $string =~ m{pattern}gimx;
13my $string =~ m{pattern}gixs;
14my $string =~ m{pattern}xgms;
15
16my $string =~ m/pattern/x;
17my $string =~ m/pattern/gimx;
18my $string =~ m/pattern/gixs;
19my $string =~ m/pattern/xgms;
20
21my $string =~ /pattern/x;
22my $string =~ /pattern/gimx;
23my $string =~ /pattern/gixs;
24my $string =~ /pattern/xgms;
25
26my $string =~ s/pattern/foo/x;
27my $string =~ s/pattern/foo/gimx;
28my $string =~ s/pattern/foo/gixs;
29my $string =~ s/pattern/foo/xgms;
30
8b5a642f
CD
31my $re =~ qr/pattern/x;
32
196197a1
AL
33#-----------------------------------------------------------------------------
34
35## name basic failures
8b5a642f 36## failures 17
196197a1
AL
37## cut
38my $string =~ m{pattern};
39my $string =~ m{pattern}gim;
40my $string =~ m{pattern}gis;
41my $string =~ m{pattern}gms;
42
43my $string =~ m/pattern/;
44my $string =~ m/pattern/gim;
45my $string =~ m/pattern/gis;
46my $string =~ m/pattern/gms;
47
48my $string =~ /pattern/;
49my $string =~ /pattern/gim;
50my $string =~ /pattern/gis;
51my $string =~ /pattern/gms;
52
53my $string =~ s/pattern/foo/;
54my $string =~ s/pattern/foo/gim;
55my $string =~ s/pattern/foo/gis;
56my $string =~ s/pattern/foo/gms;
57
8b5a642f
CD
58my $re =~ qr/pattern/;
59
df95b6a2
AL
60#-----------------------------------------------------------------------------
61
62## name tr and y formatting
63## failures 0
64## cut
65
66my $string =~ tr/[A-Z]/[a-z]/;
67my $string =~ tr|[A-Z]|[a-z]|;
68my $string =~ tr{[A-Z]}{[a-z]};
69
70my $string =~ y/[A-Z]/[a-z]/;
71my $string =~ y|[A-Z]|[a-z]|;
72my $string =~ y{[A-Z]}{[a-z]};
73
74my $string =~ tr/[A-Z]/[a-z]/cds;
75my $string =~ y/[A-Z]/[a-z]/cds;
8b5a642f 76
827f825f
ES
77
78#-----------------------------------------------------------------------------
79
80## name allow_short_regex, pass
81## failures 0
82## parms { allow_short_regex => 5 }
83## cut
84
85my $string =~ m/foo/;
86
87my $string =~ s/foo//;
88my $string =~ s/foo/bar/;
89my $string =~ s/foo/barbarbar/;
90my $string =~ s/12345//;
91
92
93#-----------------------------------------------------------------------------
94
95## name allow_short_regex, fail
96## failures 2
97## parms { allow_short_regex => 5 }
98## cut
99
100my $string =~ m/foofoo/;
101
102my $string =~ s/foofoo//;
103
104
105#-----------------------------------------------------------------------------
106
107## name allow_with_whitespace, pass
108## failures 0
109## parms { allow_with_whitespace => 1 }
110## cut
111
112my $string =~ m/foo bar/;
113
114my $string =~ s/foo bar//;
115
116
117#-----------------------------------------------------------------------------
118
119## name allow_with_whitespace, fail
120## failures 2
121## parms { allow_with_whitespace => 1 }
122## cut
123
124my $string =~ m/foobar/;
125
126my $string =~ s/foobar/foo bar/;
127
128
8b5a642f
CD
129#-----------------------------------------------------------------------------
130# Local Variables:
131# mode: cperl
132# cperl-indent-level: 4
133# fill-column: 78
134# indent-tabs-mode: nil
135# c-indentation-style: bsd
136# End:
96fed375 137# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :