nobacktick test: Use literal backtick

* Fix sed error on Mac OS, also ignore entire commented lines.
* With proper quoting, the non-POSIX \d96 escape isn't necessary, and the check should work also on Mac OS.
This commit is contained in:
Ingo Karkat
2011-07-11 21:34:41 +02:00
committed by Gina Trapani
parent 8f6070e702
commit 72fe73f3d8

View File

@@ -5,11 +5,12 @@ test_description='no old-style backtick command substitution
This test checks the todo.sh script itself for occurrences This test checks the todo.sh script itself for occurrences
of old-style backtick command substitution, which should be of old-style backtick command substitution, which should be
replaced with $(...). replaced with $(...).
On failure, it will print each offending line number and line.
' '
. ./test-lib.sh . ./test-lib.sh
test_todo_session 'no old-style backtick command substitution' <<EOF test_todo_session 'no old-style backtick command substitution' <<EOF
>>> sed -n -e 's/[ \t]#.*//' -e '/\d96/{=;p}' "$(which todo.sh)" >>> sed -n -e 's/\(^\|[ \t]\)#.*//' -e '/\`/{' -e '=;p' -e '}' "$(which todo.sh)"
EOF EOF
test_done test_done