diff options
author | Jim Meyering <meyering@redhat.com> | 2011-06-07 10:25:57 +0200 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2011-06-07 10:46:34 +0200 |
commit | 38cbab6ec7e851bdb64c68499eda5fc2e680d197 (patch) | |
tree | 09132b1113875ab77af705d26696ec9adf3880af /tests | |
parent | 4d6cfb9d1c37bbe9175d0baa081e432286cd29c2 (diff) | |
download | grep-38cbab6ec7e851bdb64c68499eda5fc2e680d197.tar.gz |
tests: fmbtest: factor
* tests/fmbtest: Factor out locale-name duplication.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/fmbtest | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/fmbtest b/tests/fmbtest index e1e77e02..4e57e28a 100755 --- a/tests/fmbtest +++ b/tests/fmbtest @@ -7,16 +7,18 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src +cz=cs_CZ.UTF-8 + # If cs_CZ.UTF-8 locale doesn't work, skip this test. -LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \ - || skip_ this system lacks the cs_CZ.UTF-8 locale +LC_ALL=$cz locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \ + || skip_ this system lacks the $cz locale # If matching is done in single-byte mode, skip this test too -printf 'é\n' | LC_ALL=cs_CZ.UTF-8 grep -Eq '^[é]{2}$' +printf 'é\n' | LC_ALL=$cz grep -Eq '^[é]{2}$' case $? in - 0) Exit 77;; + 0) skip_test_ this test works only in multibyte mode;; 1) ;; - *) Exit 1;; + *) framework_failure_ grep exited with unexpected status $? ;; esac failures=0 @@ -50,21 +52,21 @@ EOF for mode in F G E; do -test1="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \ +test1="$(echo $(LC_ALL=$cz 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 \ +test2="$(echo $(LC_ALL=$cz 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 \ +test3="$(echo $(LC_ALL=$cz 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" @@ -72,7 +74,7 @@ if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then fi # Skip the next test - known to fail. TAA. -#test4="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \ +#test4="$(echo $(LC_ALL=$cz 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" @@ -82,7 +84,7 @@ 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ší')" + | LC_ALL=$cz 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,7 +95,7 @@ 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š')" + | LC_ALL=$cz 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 @@ -105,7 +107,7 @@ 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 \ +test8="$(echo $(LC_ALL=$cz 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" |