bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20700: [PATCH] test: tighten tests for bracket exprs


From: Paul Eggert
Subject: bug#20700: [PATCH] test: tighten tests for bracket exprs
Date: Sat, 30 May 2015 12:26:22 -0700

* tests/posix-bracket: Test '[a-a[.-.]--]'.
Also, test that failures are with status 1
(nonmatching data), not status 2 (invalid expressions).
---
 tests/posix-bracket | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/posix-bracket b/tests/posix-bracket
index 4d54112..840e53e 100755
--- a/tests/posix-bracket
+++ b/tests/posix-bracket
@@ -24,10 +24,11 @@ fail=0
 
 echo a >in || framework_failure_
 for bracketed in '[.a.]' '[.a.]-a' 'a-[.a.]' '[.a.]-[.a.]' \
-    '[=a=]' '[:alpha:]'; do
+    '[=a=]' '[:alpha:]' 'a-a[.-.]--'; do
   grep "[$bracketed]" in >out || fail=1
   compare in out || fail=1
-  grep "[^$bracketed]" in >out && fail=1
+  grep "[^$bracketed]" in >out
+  test $? -eq 1 || fail=1
   compare /dev/null out || fail=1
 done
 Exit $fail
-- 
2.1.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]