diff options
| author | Jim Meyering <meyering@redhat.com> | 2012-01-07 20:55:10 +0100 |
|---|---|---|
| committer | Jim Meyering <meyering@redhat.com> | 2012-01-09 21:50:08 +0100 |
| commit | ae2b0d2ddca458eb282bb0458987e75e1875a659 (patch) | |
| tree | de928bfafb577a20963be45b4b6d97488c0b5e24 /tests/Coreutils.pm | |
| parent | tests: change `...' to '...' on lines not matching /[=\$]/ (diff) | |
| download | coreutils-ae2b0d2ddca458eb282bb0458987e75e1875a659.tar.gz coreutils-ae2b0d2ddca458eb282bb0458987e75e1875a659.zip | |
tests: more automated quote adjustment
Relax initial regexp to match more instances, but add a
filter to avoid some invalid conversions. Run this:
git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \
-e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \
-e ' s/\`([^'\''"]*?'\'')/'\''$1/g'
The last disjunct in the above (...) filter is to exempt
any line that contains this string: '\''
With quoting like that, converting a ` to ' is likely to cause trouble,
so we'll handle those manually. Here are three examples where
the exemption is required:
*': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
printf 'creating file `%s'\''\n' $f
'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
Diffstat (limited to 'tests/Coreutils.pm')
| -rw-r--r-- | tests/Coreutils.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm index 7f4a0372c..4d2d796d8 100644 --- a/tests/Coreutils.pm +++ b/tests/Coreutils.pm @@ -61,7 +61,7 @@ defined $ENV{DJDIR} # stdout from cmd # {OUT => {'filename'=>[$CTOR, $DTOR]}} $CTOR and $DTOR are references to # functions, each which is passed the single argument 'filename'. -# $CTOR must create `filename'. +# $CTOR must create 'filename'. # DTOR may be omitted in which case 'sub{unlink @_[0]}' is used. # FIXME: implement this # {ERR => ...} @@ -78,7 +78,7 @@ defined $ENV{DJDIR} # diagnostics: Operation not permitted, Not owner, and Permission denied. # {EXIT => N} expect exit status of cmd to be N # {ENV => 'VAR=val ...'} -# Prepend 'VAR=val ...' to the command that we execute via `system'. +# Prepend 'VAR=val ...' to the command that we execute via 'system'. # {ENV_DEL => 'VAR'} # Remove VAR from the environment just before running the corresponding # command, and restore any value just afterwards. @@ -114,7 +114,7 @@ sub _create_file ($$$$) ++$Global_count; } - warn "creating file `$file' with contents `$data'\n" if $debug; + warn "creating file '$file' with contents '$data'\n" if $debug; # The test spec gave a string. # Write it to a temp file and return tempfile name. @@ -183,7 +183,7 @@ sub _process_file_spec ($$$$$) else { # FIXME: put $srcdir in here somewhere - warn "$program_name: $test_name: specified file `$file' does" + warn "$program_name: $test_name: specified file '$file' does" . " not exist\n" if ! -f "$srcdir/$file"; } @@ -314,7 +314,7 @@ sub run_tests ($$$$$) . " expected 1\n" if $n != 1; my ($type, $val) = each %$io_spec; - die "$program_name: $test_name: invalid key `$type' in test spec\n" + die "$program_name: $test_name: invalid key '$type' in test spec\n" if ! $Types{$type}; # Make sure there's no more than one of OUT, ERR, EXIT, etc. @@ -350,7 +350,7 @@ sub run_tests ($$$$$) or die "$program_name: $test_name: CMP spec has $n " . "elements -- expected 1\n"; - # Replace any `@AUX@' in the key of %$e. + # Replace any '@AUX@' in the key of %$e. my ($ff, $val) = each %$e; my $new_ff = _at_replace $expect, $ff; if ($new_ff ne $ff) @@ -474,7 +474,7 @@ sub run_tests ($$$$$) and $pushed_env{$env_sym} = $val; } - warn "Running command: `$cmd_str'\n" if $debug; + warn "Running command: '$cmd_str'\n" if $debug; my $rc = 0xffff & system $cmd_str; # Restore any environment setting we changed via a deletion. @@ -486,7 +486,7 @@ sub run_tests ($$$$$) if ($rc == 0xff00) { warn "$program_name: test $test_name failed: command failed:\n" - . " `$cmd_str': $!\n"; + . " '$cmd_str': $!\n"; $fail = 1; goto cleanup; } |
