| 1 |
## name Non-topic explicitness |
| 2 |
## failures 0 |
| 3 |
## cut |
| 4 |
|
| 5 |
my $foo = 'Whatever'; |
| 6 |
|
| 7 |
$foo =~ /foo/; |
| 8 |
$foo =~ m/foo/; |
| 9 |
$foo =~ s/foo/bar/; |
| 10 |
$foo =~ tr/a-mn-z/n-za-m/; |
| 11 |
|
| 12 |
#----------------------------------------------------------------------------- |
| 13 |
|
| 14 |
## name Topical exclusion |
| 15 |
## failures 0 |
| 16 |
## cut |
| 17 |
|
| 18 |
/foo/; |
| 19 |
m/foo/; |
| 20 |
s/foo/bar/; |
| 21 |
tr/a-mn-z/n-za-m/; |
| 22 |
|
| 23 |
#----------------------------------------------------------------------------- |
| 24 |
|
| 25 |
## name Useless topic |
| 26 |
## failures 10 |
| 27 |
## cut |
| 28 |
|
| 29 |
$_ =~ /foo/; |
| 30 |
$_ =~ m/foo/; |
| 31 |
$_ =~ s/foo/bar/; |
| 32 |
$_ =~ tr/a-mn-z/n-za-m/; |
| 33 |
$_ =~ y/a-mn-z/n-za-m/; |
| 34 |
|
| 35 |
# Plus some without spacing |
| 36 |
|
| 37 |
$_=~/foo/; |
| 38 |
$_=~m/foo/; |
| 39 |
$_=~s/foo/bar/; |
| 40 |
$_=~tr/a-mn-z/n-za-m/; |
| 41 |
$_=~y/a-mn-z/n-za-m/; |
| 42 |
|
| 43 |
#----------------------------------------------------------------------------- |
| 44 |
|
| 45 |
## name Useless topic in a negative match |
| 46 |
## failures 5 |
| 47 |
## cut |
| 48 |
|
| 49 |
$_ !~ /foo/; |
| 50 |
$_ !~ m/foo/; |
| 51 |
$_ !~ s/foo/bar/; |
| 52 |
$_ !~ tr/a-mn-z/n-za-m/; |
| 53 |
$_ !~ y/a-mn-z/n-za-m/; |
| 54 |
|
| 55 |
#----------------------------------------------------------------------------- |
| 56 |
|
| 57 |
## name Match against qr object |
| 58 |
## failures 2 |
| 59 |
## cut |
| 60 |
|
| 61 |
$_ =~ qr/bar/; |
| 62 |
$_ !~ qr/bar/; |
| 63 |
|
| 64 |
#----------------------------------------------------------------------------- |
| 65 |
|
| 66 |
## name Not useless matching against a variable |
| 67 |
## failures 0 |
| 68 |
## cut |
| 69 |
|
| 70 |
my $non_useless_topic_regex = qr/foo.+bar/; |
| 71 |
$_ =~ $non_useless_topic_regex; |
| 72 |
|
| 73 |
#----------------------------------------------------------------------------- |
| 74 |
|
| 75 |
## name More complex constructions |
| 76 |
## failures 8 |
| 77 |
## cut |
| 78 |
|
| 79 |
my $x = scalar( grep { $_ =~ m/^INFO: .*$/ } @foo ); |
| 80 |
$x = 3 if $_ !~ s/foo/bar/; |
| 81 |
$_ =~ s/\s+$// foreach ($name, $zip, $phone); |
| 82 |
our @paths = grep { $_ =~ /./ } <DATA>; # get non-blank lines from the end |
| 83 |
next if $_ =~ m/^\s*#/; |
| 84 |
$condition_count += ($_ =~ tr/,/,/) foreach values %requirements; |
| 85 |
my ( $v ) = grep { $_ =~ /^\s*our\s+\$VERSION\s*=\s*['"]\d/ } <$fh>; |
| 86 |
assert( ! grep { $_ =~ m/\|/ } @$suggestions, 'no suggestion contains a pipe character (reserved for future field separator)' ); |
| 87 |
|
| 88 |
#----------------------------------------------------------------------------- |
| 89 |
|
| 90 |
## name Potential false positives, but none should fail. |
| 91 |
## failures 0 |
| 92 |
## cut |
| 93 |
|
| 94 |
$x =~ /foo/; |
| 95 |
$_ += /foo/; |
| 96 |
print s/x/y/; |
| 97 |
foo(tr/x/y/); |
| 98 |
+tr/x/y/; |
| 99 |
# $_ =~ /foo/ |
| 100 |
'foo' =~ $_; |
| 101 |
$_ =~ $some_qr_var; |
| 102 |
ok( ( grep { $_ =~ $regwarn } ( $title->warnings() ) ), 'expected warning text reported' ); |
| 103 |
my ( $line, $dummy ) = grep { $_ =~ $stat->{regex} } @contents; |
| 104 |
if ($_ !~ $pat) { foo(); } |
| 105 |
=head1 $_ =~ /foo/ |
| 106 |
|
| 107 |
#----------------------------------------------------------------------------- |
| 108 |
# Local Variables: |
| 109 |
# mode: cperl |
| 110 |
# cperl-indent-level: 4 |
| 111 |
# fill-column: 78 |
| 112 |
# indent-tabs-mode: nil |
| 113 |
# c-indentation-style: bsd |
| 114 |
# End: |
| 115 |
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |