Subject: [PATCH] test: tighten tests for bracket exprs

From: Paul Eggert <[email-masked]>
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