diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/fgrep-infloop | 14 | ||||
-rwxr-xr-x | tests/invalid-multibyte-infloop | 11 | ||||
-rwxr-xr-x | tests/prefix-of-multibyte | 36 |
3 files changed, 44 insertions, 17 deletions
diff --git a/tests/fgrep-infloop b/tests/fgrep-infloop index 07a0ce04..015ec74d 100755 --- a/tests/fgrep-infloop +++ b/tests/fgrep-infloop @@ -8,14 +8,20 @@ require_compiled_in_MB_support encode() { echo "$1" | tr ABC '\357\274\241'; } +encode ABC > in || framework_failure_ fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do out=out1-$LOC - encode ABC \ - | LC_ALL=$LOC timeout 10s grep -F "$(encode BC)" > $out 2>&1 - test $? = 1 || fail=1 - compare /dev/null $out || fail=1 + LC_ALL=$LOC timeout 10s grep -F "$(encode BC)" in > $out + status=$? + if test $status -eq 0; then + compare in $out + elif test $status -eq 1; then + compare_dev_null_ /dev/null $out + else + test $status -eq 2 + fi || fail=1 done Exit $fail diff --git a/tests/invalid-multibyte-infloop b/tests/invalid-multibyte-infloop index e98c1707..b28bc532 100755 --- a/tests/invalid-multibyte-infloop +++ b/tests/invalid-multibyte-infloop @@ -14,7 +14,14 @@ encode AA > input fail=0 # Before 2.15, this would infloop. -LC_ALL=en_US.UTF-8 timeout 3 grep -F $(encode A) input > out || fail=1 -compare input out || fail=1 +LC_ALL=en_US.UTF-8 timeout 3 grep -F $(encode A) input > out +status=$? +if test $status -eq 0; then + compare input out +elif test $status -eq 1; then + compare_dev_null_ /dev/null out +else + test $status -eq 2 +fi || fail=1 Exit $fail diff --git a/tests/prefix-of-multibyte b/tests/prefix-of-multibyte index 2ab9a99a..2228a22b 100755 --- a/tests/prefix-of-multibyte +++ b/tests/prefix-of-multibyte @@ -9,21 +9,35 @@ encode() { echo "$1" | tr ABC '\357\274\241'; } encode ABC >exp1 encode aABC >exp2 +encode ABCABC >exp3 +encode _____________________ABCABC___ >exp4 fail=0 for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do - for type in dfa fgrep regex; do - case $type in - dfa) opt= prefix= ;; - fgrep) opt=-F prefix= ;; - regex) opt= prefix='\(\)\1' ;; - esac - out=out-$type-$LOC - LC_ALL=$LOC grep $opt "$prefix$(encode A)" exp1 >$out || fail=1 - compare exp1 $out || fail=1 - LC_ALL=$LOC grep $opt "$prefix$(encode aA)" exp2 >$out || fail=1 - compare exp2 $out || fail=1 + for pat in A aA BCA; do + for file in exp1 exp2 exp3 exp4; do + for type in regex dfa fgrep; do + case $type in + dfa) opt= prefix= ;; + fgrep) opt=-F prefix= ;; + regex) opt= prefix='\(\)\1' ;; + esac + pattern=$prefix$(encode $pat) + out=out-$type-$LOC + LC_ALL=$LOC grep $opt "$pattern" $file >$out + status=$? + echo $status >$out.status + if test $status -eq 0; then + compare $file $out + elif test $status -eq 1; then + compare_dev_null_ /dev/null $out + else + test $status -eq 2 + fi || fail=1 + compare out-regex-$LOC.status $out.status || fail=1 + done + done done done |