diff options
author | Jim Meyering <meyering@redhat.com> | 2010-05-15 17:58:52 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-05-31 10:59:11 +0200 |
commit | f385d97a4144a30e23bc35ce8ec33c26b6cd84e9 (patch) | |
tree | c4626695045ca2ec0f47458d7c4d21ee6932ab91 | |
parent | 200501052edde61747a16cd0af60fa925ef87bfb (diff) | |
download | coreutils-f385d97a4144a30e23bc35ce8ec33c26b6cd84e9.tar.xz |
tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}
Run this command:
git grep -l "limits->{'" \
| xargs perl -pi -e "s/limits->{'(.*?)'}/limits->{\$1}/g"
* cfg.mk (sc_prohibit_perl_hash_quotes): New rule to match.
* tests/misc/join: Remove quotes.
* tests/misc/sort: Likewise.
* tests/misc/sort-merge: Likewise.
* tests/misc/test: Likewise.
* tests/misc/unexpand: Likewise.
* tests/misc/uniq: Likewise.
-rw-r--r-- | cfg.mk | 5 | ||||
-rwxr-xr-x | tests/misc/join | 4 | ||||
-rwxr-xr-x | tests/misc/sort | 4 | ||||
-rwxr-xr-x | tests/misc/sort-merge | 2 | ||||
-rwxr-xr-x | tests/misc/test | 6 | ||||
-rwxr-xr-x | tests/misc/unexpand | 2 | ||||
-rwxr-xr-x | tests/misc/uniq | 4 |
7 files changed, 16 insertions, 11 deletions
@@ -233,6 +233,11 @@ sc_require_stdio_safer: else :; \ fi +sc_prohibit_perl_hash_quotes: + @prohibit="\{'[A-Z_]+' *[=}]" \ + halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \ + $(_sc_search_regexp) + # Prefer xnanosleep over other less-precise sleep methods sc_prohibit_sleep: @prohibit='\<(nano|u)?sleep \(' \ diff --git a/tests/misc/join b/tests/misc/join index cef813773..0e34ba867 100755 --- a/tests/misc/join +++ b/tests/misc/join @@ -146,9 +146,9 @@ my @tv = ( t_subst "a:1:2:\nb:1:2:\n", 0], # fields > SIZE_MAX are silently interpreted as SIZE_MAX -['bigfield1', "-1 $limits->{'UINTMAX_OFLOW'} -2 2", +['bigfield1', "-1 $limits->{UINTMAX_OFLOW} -2 2", ["a\n", "b\n"], " a b\n", 0], -['bigfield2', "-1 $limits->{'SIZE_OFLOW'} -2 2", +['bigfield2', "-1 $limits->{SIZE_OFLOW} -2 2", ["a\n", "b\n"], " a b\n", 0], # FIXME: change this to ensure the diagnostic makes sense diff --git a/tests/misc/sort b/tests/misc/sort index 4ca52fe9c..0b098452d 100755 --- a/tests/misc/sort +++ b/tests/misc/sort @@ -353,9 +353,9 @@ my @Tests = {IN=>"a\0z\01\nb\0y\02\n"}, {OUT=>"b\0y\02\na\0z\01\n"}], # fields > SIZE_MAX are silently interpreted as SIZE_MAX -["bigfield1", "-k $limits->{'UINTMAX_OFLOW'}", +["bigfield1", "-k $limits->{UINTMAX_OFLOW}", {IN=>"2\n1\n"}, {OUT=>"1\n2\n"}], -["bigfield2", "-k $limits->{'SIZE_OFLOW'}", +["bigfield2", "-k $limits->{SIZE_OFLOW}", {IN=>"2\n1\n"}, {OUT=>"1\n2\n"}], # Using an old-style key-specifying option like +1 with an invalid diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge index 70fc7b4ec..c659505a8 100755 --- a/tests/misc/sort-merge +++ b/tests/misc/sort-merge @@ -34,7 +34,7 @@ my $big_input = "aaa\n" x 1024; # don't need to check for existence, since we're running in a temp dir my $badtmp = 'does/not/exist'; -my $bigint = $limits->{'UINTMAX_OFLOW'}; +my $bigint = $limits->{UINTMAX_OFLOW}; my @Tests = ( diff --git a/tests/misc/test b/tests/misc/test index 799bff0ca..da33de795 100755 --- a/tests/misc/test +++ b/tests/misc/test @@ -158,19 +158,19 @@ my @Tests = ['eq-3', qw(0 -eq 00)], ['eq-4', qw(8 -eq 9), {EXIT=>1}], ['eq-5', qw(1 -eq 0), {EXIT=>1}], - ['eq-6', "$limits->{'UINTMAX_OFLOW'} -eq 0", {EXIT=>1}], + ['eq-6', "$limits->{UINTMAX_OFLOW} -eq 0", {EXIT=>1}], ['gt-1', qw(5 -gt 5), {EXIT=>1}], ['gt-2', qw(5 -gt 4)], ['gt-3', qw(4 -gt 5), {EXIT=>1}], ['gt-4', qw(-1 -gt -2)], - ['gt-5', "$limits->{'UINTMAX_OFLOW'} -gt $limits->{'INTMAX_UFLOW'}"], + ['gt-5', "$limits->{UINTMAX_OFLOW} -gt $limits->{INTMAX_UFLOW}"], ['lt-1', qw(5 -lt 5), {EXIT=>1}], ['lt-2', qw(5 -lt 4), {EXIT=>1}], ['lt-3', qw(4 -lt 5)], ['lt-4', qw(-1 -lt -2), {EXIT=>1}], - ['lt-5', "$limits->{'INTMAX_UFLOW'} -lt $limits->{'UINTMAX_OFLOW'}"], + ['lt-5', "$limits->{INTMAX_UFLOW} -lt $limits->{UINTMAX_OFLOW}"], ['inv-1', qw(0x0 -eq 00), {EXIT=>2}, {ERR=>"$prog: invalid integer `0x0'\n"}], diff --git a/tests/misc/unexpand b/tests/misc/unexpand index 327db9ec9..d98da5837 100755 --- a/tests/misc/unexpand +++ b/tests/misc/unexpand @@ -78,7 +78,7 @@ my @Tests = # It is debatable whether this test should require an environment # setting of e.g., _POSIX2_VERSION=1. - ['obs-ovflo', "-$limits->{'UINTMAX_OFLOW'}", {IN=>''}, {OUT=>''}, + ['obs-ovflo', "-$limits->{UINTMAX_OFLOW}", {IN=>''}, {OUT=>''}, {EXIT => 1}, {ERR => "$prog: tab stop value is too large\n"}], ); diff --git a/tests/misc/uniq b/tests/misc/uniq index e49fe756d..4d1f8a4ff 100755 --- a/tests/misc/uniq +++ b/tests/misc/uniq @@ -194,8 +194,8 @@ my @Tests = . $try}], # Check that -d and -u suppress all output, as POSIX requires. ['120', qw(-d -u), {IN=>"a\na\n\b"}, {OUT=>""}], - ['121', "-d -u -w$limits->{'UINTMAX_OFLOW'}", {IN=>"a\na\n\b"}, {OUT=>""}], - ['122', "-d -u -w$limits->{'SIZE_OFLOW'}", {IN=>"a\na\n\b"}, {OUT=>""}], + ['121', "-d -u -w$limits->{UINTMAX_OFLOW}", {IN=>"a\na\n\b"}, {OUT=>""}], + ['122', "-d -u -w$limits->{SIZE_OFLOW}", {IN=>"a\na\n\b"}, {OUT=>""}], # Check that --zero-terminated is synonymous with -z. ['123', '--zero-terminated', {IN=>"a\na\nb"}, {OUT=>"a\na\nb\0"}], ['124', '--zero-terminated', {IN=>"a\0a\0b"}, {OUT=>"a\0b\0"}], |