summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2010-03-29 11:26:08 +0200
committerPaolo Bonzini <bonzini@gnu.org>2010-03-29 11:31:15 +0200
commit37ad224185f1046c35e76b95dab43d7c65cd2a22 (patch)
tree4e861ca81bd06375e3512a0bed9656271763c9f0
parent0f7ab96dc723ccc497d652a72798661adf9504c6 (diff)
downloadgrep-37ad224185f1046c35e76b95dab43d7c65cd2a22.tar.gz
tests: use $(...) consistently
* tests/backref.sh: Use `...' instead of ``...'' in comments. * tests/bre.awk: Use $(...) instead of `...`. * tests/ere.awk: Use $(...) instead of `...`. * tests/euc-mb: Use $(...) instead of `...`. * tests/fmbtest: Use $(...) instead of `...`. * tests/foad1: Use $(...) instead of `...`. * tests/pcre-z: Use $(...) instead of `...`. Quote output of grep. * tests/spencer1-locale.awk: Use $(...) instead of `...`. * tests/spencer1.awk: Use $(...) instead of `...`. * tests/yesno.sh: Use $(...) instead of `...`.
-rwxr-xr-xtests/backref.sh2
-rw-r--r--tests/bre.awk4
-rw-r--r--tests/ere.awk4
-rw-r--r--tests/euc-mb4
-rwxr-xr-xtests/fmbtest28
-rwxr-xr-xtests/foad12
-rwxr-xr-xtests/pcre-z2
-rw-r--r--tests/spencer1-locale.awk2
-rw-r--r--tests/spencer1.awk4
-rwxr-xr-xtests/yesno.sh6
10 files changed, 29 insertions, 29 deletions
diff --git a/tests/backref.sh b/tests/backref.sh
index 11e2c7c9..d76206ff 100755
--- a/tests/backref.sh
+++ b/tests/backref.sh
@@ -19,7 +19,7 @@ if test $? -ne 0 ; then
fi
# hit hard with the `Bond' tests
-# For now, remove the ``?'' in the last parentheses, so that new glibc can do it. --Stepan
+# For now, remove the `?' in the last parentheses, so that new glibc can do it. --Stepan
echo "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1
if test $? -ne 0 ; then
echo "Options: Bond, test #2 failed"
diff --git a/tests/bre.awk b/tests/bre.awk
index 9be5244f..d8aad74e 100644
--- a/tests/bre.awk
+++ b/tests/bre.awk
@@ -14,8 +14,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
-# printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $? ; }`\n",$3, $2);
+# printf ("status=$(echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $? ; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer bre test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/ere.awk b/tests/ere.awk
index 737e3efd..9a886bf5 100644
--- a/tests/ere.awk
+++ b/tests/ere.awk
@@ -14,8 +14,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
-# printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; }`\n",$3, $2);
+# printf ("status=$(echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer ere test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/euc-mb b/tests/euc-mb
index 590bd91b..9994657f 100644
--- a/tests/euc-mb
+++ b/tests/euc-mb
@@ -12,12 +12,12 @@ make_input () {
}
euc_grep () {
- pat=`make_input "$1"`
+ pat=$(make_input "$1")
LC_ALL=$locale grep "$pat"
}
-case `get-mb-cur-max $locale` in
+case $(get-mb-cur-max $locale) in
2|3) ;;
*) skip_ 'EUC-JP locale not found' ;;
esac
diff --git a/tests/fmbtest b/tests/fmbtest
index 8a00b2a7..6fd6d0a9 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -51,30 +51,30 @@ EOF
for mode in F G E; do
-test1="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test1="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test1" != "11 12 13 14 15 16 17 18"; then
echo "Test #1 ${mode} failed: $test1"
failures=1
fi
-test2="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test2="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #2 ${mode} failed: $test2"
failures=1
fi
-test3="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test3="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #3 ${mode} failed: $test3"
failures=1
fi
# Skip the next test - known to fail. TAA.
-#test4="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \
-# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+#test4="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \
+# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
#if test "$test4" != "01 02 08 13 17 19"; then
# echo "Test #4 ${mode} failed: $test4"
# failures=1
@@ -82,8 +82,8 @@ fi
# Test that --color=always does not depend on individual pattern order within the pattern
# list, and that a longer match is preferred to a shorter one starting at the same point.
-test6="`echo 'Cosi tu ČišÍ...' \
- | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiš' -e 'čiší'`"
+test6="$(echo 'Cosi tu ČišÍ...' \
+ | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiš' -e 'čiší')"
if echo "$test6" | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
:
else
@@ -93,8 +93,8 @@ fi
# Test that --color=always does not depend on individual pattern order within the pattern
# list, and that a longer match is preferred to a shorter one starting at the same point.
-test7="`echo 'Cosi tu ČišÍ...' \
- | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiší' -e 'čiš'`"
+test7="$(echo 'Cosi tu ČišÍ...' \
+ | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'čiší' -e 'čiš')"
if echo "$test7" | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
:
else
@@ -106,8 +106,8 @@ done
for mode in G E; do
-test8="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test8="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #8 ${mode} failed: $test8"
failures=1
diff --git a/tests/foad1 b/tests/foad1
index 150c2b0d..9492fadb 100755
--- a/tests/foad1
+++ b/tests/foad1
@@ -23,7 +23,7 @@ grep_test ()
INPUT="$1"
EXPECT="$2"
shift 2
- OUTPUT=`printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/"`
+ OUTPUT=$(printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/")
if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "yes"; then
echo "Testing: grep $@"
test "$LC_ALL" != C && test "$LC_ALL" != "" && echo " LC_ALL: \"$LC_ALL\""
diff --git a/tests/pcre-z b/tests/pcre-z
index 17d9f955..f59c1faa 100755
--- a/tests/pcre-z
+++ b/tests/pcre-z
@@ -14,7 +14,7 @@ grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.'
compare err /dev/null || fail_ 'stderr not empty on grep -z.'
# Sanity check the output
-test `grep -cz "$REGEX" in` 2>err = 3 || fail_ 'Incorrect BRE (grep -cz) match.'
+test "$(grep -cz "$REGEX" in)" 2>err = 3 || fail_ 'Incorrect BRE (grep -cz) match.'
compare err /dev/null || fail_ 'stderr not empty on grep -cz.'
fail=0
diff --git a/tests/spencer1-locale.awk b/tests/spencer1-locale.awk
index ff893429..759cafc6 100644
--- a/tests/spencer1-locale.awk
+++ b/tests/spencer1-locale.awk
@@ -22,7 +22,7 @@ $0 !~ /^#/ && NF == 3 {
function test(locale)
{
- printf ("status=`echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null 2>&1 ; echo $?; }`\n",$3, locale, $2);
+ printf ("status=$(echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, locale, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer test \\#%d failed \\(%s\\)\n", ++n, locale);
printf ("\tfailures=1\n");
diff --git a/tests/spencer1.awk b/tests/spencer1.awk
index ffd4fb4f..06f90b76 100644
--- a/tests/spencer1.awk
+++ b/tests/spencer1.awk
@@ -11,8 +11,8 @@ BEGIN {
}
$0 !~ /^#/ && NF == 3 {
-# printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo $?; }`\n",$3, $2);
+# printf ("status=$(echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo $?; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/yesno.sh b/tests/yesno.sh
index 88415d3a..49f3feca 100755
--- a/tests/yesno.sh
+++ b/tests/yesno.sh
@@ -110,11 +110,11 @@ shift
# Test execution and reporting.
t=1
while test xx != "x$1"; do
- opts=`echo "$1" | sed 's/,/ /g'`
+ opts=$(echo "$1" | sed 's/,/ /g')
expect="$2"
shift 2
- output=`{ $GREP -F -n -b $opts yes 2>/dev/null; echo "?$?"; sed 's!^!X!'; } < "$yn" | tr '\n' '/'`
+ output=$({ $GREP -F -n -b $opts yes 2>/dev/null; echo "?$?"; sed 's!^!X!'; } < "$yn" | tr '\n' '/')
if test "$output" != "$expect" || test "$VERBOSE" = "1"; then
echo " Test #$t: { $GREP -F -n -b $opts yes; echo \"?\$?\"; sed 's!^!X!'; }"
@@ -128,7 +128,7 @@ while test xx != "x$1"; do
echo ' PASS'
fi
- t=`expr $t + 1`
+ t=$(expr $t + 1)
done
exit $failures