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