tests: solaris sh can not negate exit status with '!' stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 23 Apr 2012 01:39:26 +0200
branchstable
changeset 16485 f48b075ff088
parent 16484 bf877ebed866
child 16486 ac987a9d8d49
tests: solaris sh can not negate exit status with '!'
contrib/check-code.py
tests/test-check-code-hg.t
--- a/contrib/check-code.py	Mon Apr 23 01:39:26 2012 +0200
+++ b/contrib/check-code.py	Mon Apr 23 01:39:26 2012 +0200
@@ -73,6 +73,7 @@
     (r'^stop\(\)', "don't use 'stop' as a shell function name"),
     (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
     (r'^alias\b.*=', "don't use alias, use a function"),
+    (r'if\s*!', "don't use '!' to negate exit status"),
   ],
   # warnings
   []
--- a/tests/test-check-code-hg.t	Mon Apr 23 01:39:26 2012 +0200
+++ b/tests/test-check-code-hg.t	Mon Apr 23 01:39:26 2012 +0200
@@ -1,6 +1,7 @@
   $ check_code="$TESTDIR"/../contrib/check-code.py
   $ cd "$TESTDIR"/..
-  $ if ! hg identify -q > /dev/null; then
+  $ if hg identify -q > /dev/null; then :
+  > else
   >     echo "skipped: not a Mercurial working dir" >&2
   >     exit 80
   > fi