Skip to content

Commit 7bb1900

Browse files
committed
no loop
1 parent a800992 commit 7bb1900

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

test/assert-no-assertTrue.bash

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ if [[ $# -lt 1 ]]; then
55
exit 1
66
fi
77

8-
funcs=(assertTrue)
98
rc=0
10-
for func in "${funcs[@]}"; do
11-
# --color=never because magit git output log doesn't support it
12-
grep_rc=0; grep -H --color=never --line-number -P '\b'"$func"'\s*[\(;]' "$@" || grep_rc=$?
13-
case "$grep_rc" in
14-
0)
15-
echo "$func() is not allowed! use an exception instead."; rc=1 ;;
16-
1)
17-
: ;; # code is good, do nothing
18-
*)
19-
echo "grep failed!"; rc=1 ;;
20-
esac
21-
done
9+
# --color=never because magit git output log doesn't support it
10+
grep_rc=0; grep -H --color=never --line-number -P '\bassertTrue\s*[\(;]' "$@" || grep_rc=$?
11+
case "$grep_rc" in
12+
0)
13+
echo "assertTrue() is not allowed! use assert() instead."; rc=1 ;;
14+
1)
15+
: ;; # code is good, do nothing
16+
*)
17+
echo "grep failed!"; rc=1 ;;
18+
esac
2219
exit "$rc"

0 commit comments

Comments
 (0)