bug#6317: [PATCH] tests: remove unnecessary single quotes in perl hash u (original) (raw)

[Top][All Lists]


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Jim Meyering
Subject: bug#6317: [PATCH] tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}
Date: Mon, 31 May 2010 11:01:57 +0200

i.e.

in Perl code, write <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>h</mi><mi>a</mi><mi>s</mi><mi>h</mi><mrow><mi>K</mi><mi>E</mi><mi>Y</mi></mrow><mo separator="true">,</mo><mi>n</mi><mi>o</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">hash{KEY}, not </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">ha</span><span class="mord mathnormal">s</span><span class="mord mathnormal">h</span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07153em;">K</span><span class="mord mathnormal" style="margin-right:0.05764em;">E</span><span class="mord mathnormal" style="margin-right:0.22222em;">Y</span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">n</span><span class="mord mathnormal">o</span><span class="mord mathnormal">t</span></span></span></span>hash{'KEY'}

From f385d97a4144a30e23bc35ce8ec33c26b6cd84e9 Mon Sep 17 00:00:00 2001 From: Jim Meyering <address@hidden> Date: Sat, 15 May 2010 17:58:52 +0200 Subject: [PATCH] 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.

cfg.mk | 5 +++++ tests/misc/join | 4 ++-- tests/misc/sort | 4 ++-- tests/misc/sort-merge | 2 +- tests/misc/test | 6 +++--- tests/misc/unexpand | 2 +- tests/misc/uniq | 4 ++-- 7 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/cfg.mk b/cfg.mk index ae05f8c..dff5de5 100644 --- a/cfg.mk +++ b/cfg.mk @@ -233,6 +233,11 @@ sc_require_stdio_safer: else :;
fi

+sc_prohibit_perl_hash_quotes:

diff --git a/tests/misc/join b/tests/misc/join index cef8137..0e34ba8 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 4ca52fe..0b09845 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 70fc7b4..c659505 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=bigint = bigint=limits->{'UINTMAX_OFLOW'}; +my bigint=bigint = bigint=limits->{UINTMAX_OFLOW};

my @Tests = ( diff --git a/tests/misc/test b/tests/misc/test index 799bff0..da33de7 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}],

diff --git a/tests/misc/unexpand b/tests/misc/unexpand index 327db9e..d98da58 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.

diff --git a/tests/misc/uniq b/tests/misc/uniq index e49fe75..4d1f8a4 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"}],

1.7.1.348.gb26ba



[Prev in Thread] Current Thread [Next in Thread]