summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2010-03-17 10:17:34 +0100
committerPaolo Bonzini <bonzini@gnu.org>2010-03-17 10:17:34 +0100
commit77bb554c759ab305aa93950c82c0b70566d951ef (patch)
tree0ce879124c1299a8fc363aa8302c60c02af8c92e /tests
parentcf46bc2ef758dd1d0750fefca2f2cef247145c56 (diff)
downloadgrep-77bb554c759ab305aa93950c82c0b70566d951ef.tar.gz
tests: factor name of output files into a variable
* tests/case-fold-backref, tests/case-fold-char-class, tests/case-fold-char-range, tests/case-fold-char-type, tests/dfaexec-multibyte: Use a variable for the output filename, as it is common to the grep and compare invocations.
Diffstat (limited to 'tests')
-rw-r--r--tests/case-fold-backref5
-rw-r--r--tests/case-fold-char-class10
-rw-r--r--tests/case-fold-char-range10
-rw-r--r--tests/case-fold-char-type10
-rw-r--r--tests/dfaexec-multibyte15
5 files changed, 30 insertions, 20 deletions
diff --git a/tests/case-fold-backref b/tests/case-fold-backref
index 528d847a..0af7a193 100644
--- a/tests/case-fold-backref
+++ b/tests/case-fold-backref
@@ -7,8 +7,9 @@ printf 'the the\nThe the\nTHE the\n' > exp1 || framework_failure
fail=0
for LOC in en_US.UTF-8 en_US zh_CN $LOCALE_FR_UTF8 C; do
- LC_ALL=$LOC grep -Ei '(the) \1' exp1 > out1-$LOC || fail=1
- compare out1-$LOC exp1 || fail=1
+ out=out1-$LOC
+ LC_ALL=$LOC grep -Ei '(the) \1' exp1 > $out || fail=1
+ compare $out exp1 || fail=1
done
Exit $fail
diff --git a/tests/case-fold-char-class b/tests/case-fold-char-class
index 46f0d4cd..09f753b9 100644
--- a/tests/case-fold-char-class
+++ b/tests/case-fold-char-class
@@ -7,15 +7,17 @@ printf 'Y\n' > exp1 || framework_failure
fail=0
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf 'X\nY\nZ\n' | LC_ALL=$LOC grep -i '[y]' > out1-$LOC || fail=1
- compare out1-$LOC exp1 || fail=1
+ out=out1-$LOC
+ printf 'X\nY\nZ\n' | LC_ALL=$LOC grep -i '[y]' > $out || fail=1
+ compare $out exp1 || fail=1
done
printf 'y\n' > exp2 || framework_failure
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf 'x\ny\nz\n' | LC_ALL=$LOC grep -i '[Y]' > out2-$LOC || fail=1
- compare out2-$LOC exp2 || fail=1
+ out=out2-$LOC
+ printf 'x\ny\nz\n' | LC_ALL=$LOC grep -i '[Y]' > $out || fail=1
+ compare $out exp2 || fail=1
done
Exit $fail
diff --git a/tests/case-fold-char-range b/tests/case-fold-char-range
index 6db53981..98978b06 100644
--- a/tests/case-fold-char-range
+++ b/tests/case-fold-char-range
@@ -7,16 +7,18 @@ printf 'A\nZ\n' > exp1 || framework_failure
fail=0
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf 'A\n1\nZ\n.\n' | LC_ALL=$LOC grep -i '[a-z]' > out1-$LOC || fail=1
- compare out1-$LOC exp1 || fail=1
+ out=out1-$LOC
+ printf 'A\n1\nZ\n.\n' | LC_ALL=$LOC grep -i '[a-z]' > $out || fail=1
+ compare $out exp1 || fail=1
done
# This actually passes also for grep-2.5.3
printf 'a\nz\n' > exp2 || framework_failure
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf 'a\n1\nz\n.\n' | LC_ALL=$LOC grep -i '[A-Z]' > out2-$LOC || fail=1
- compare out2-$LOC exp2 || fail=1
+ out=out2-$LOC
+ printf 'a\n1\nz\n.\n' | LC_ALL=$LOC grep -i '[A-Z]' > $out || fail=1
+ compare $out exp2 || fail=1
done
Exit $fail
diff --git a/tests/case-fold-char-type b/tests/case-fold-char-type
index e2d48356..0986248e 100644
--- a/tests/case-fold-char-type
+++ b/tests/case-fold-char-type
@@ -7,15 +7,17 @@ printf 'Y\n' > exp1 || framework_failure
fail=0
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf '1\nY\n.\n' | LC_ALL=$LOC grep -i '[[:lower:]]' > out1-$LOC || fail=1
- compare out1-$LOC exp1 || fail=1
+ out=out1-$LOC
+ printf '1\nY\n.\n' | LC_ALL=$LOC grep -i '[[:lower:]]' > $out || fail=1
+ compare $out exp1 || fail=1
done
printf 'y\n' > exp2 || framework_failure
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- printf '1\ny\n.\n' | LC_ALL=$LOC grep -i '[[:upper:]]' > out2-$LOC || fail=1
- compare out2-$LOC exp2 || fail=1
+ out=out2-$LOC
+ printf '1\ny\n.\n' | LC_ALL=$LOC grep -i '[[:upper:]]' > $out || fail=1
+ compare $out exp2 || fail=1
done
Exit $fail
diff --git a/tests/dfaexec-multibyte b/tests/dfaexec-multibyte
index ea5c428d..0aeac594 100644
--- a/tests/dfaexec-multibyte
+++ b/tests/dfaexec-multibyte
@@ -9,14 +9,17 @@ printf '1 2 3\n' > exp2 || framework_failure
fail=0
for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do
- LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp1 > out1-ab-$LOC || fail=1
- compare out1-ab-$LOC exp1 || fail=1
+ out=out1-ab-$LOC
+ LC_ALL=$LOC grep -E '([a]|[b]){2}' < exp1 > $out || fail=1
+ compare $out exp1 || fail=1
- LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp1 > out1-ba-$LOC || fail=1
- compare out1-ba-$LOC exp1 || fail=1
+ out=out1-ba-$LOC
+ LC_ALL=$LOC grep -E '([b]|[a]){2}' < exp1 > $out || fail=1
+ compare $out exp1 || fail=1
- LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp2 > out2-$LOC || fail=1
- compare out2-$LOC exp2 || fail=1
+ out=out2-$LOC
+ LC_ALL=$LOC grep -E '^([[:digit:]]+[[:space:]]+){2}' < exp2 > $out || fail=1
+ compare $out exp2 || fail=1
done