Skip to content

Commit c0a3163

Browse files
committed
refactor
1 parent 18c3c8e commit c0a3163

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/assert-no-die-exit.bash

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ if [[ $# -lt 1 ]]; then
66
fi
77

88
# --color=never because magit git output log doesn't support it
9-
die_occurrences="$(grep -H --color=never --line-number -P '\bdie\s*\(' "$@" | grep -v -P 'UnitySite::die\s*\(')" || true
9+
die_occurrences="$(
10+
grep -H --color=never --line-number -P '\bdie\s*[\(;]' "$@" | grep -v -P 'UnitySite::die'
11+
)" || true
1012
if [ -n "$die_occurrences" ]; then
11-
echo "die() is not allowed! use UnitySite::die() instead."
13+
echo "die is not allowed! use UnitySite::die() instead."
1214
echo "$die_occurrences"
1315
exit 1
1416
fi
1517

1618
# --color=never because magit git output log doesn't support it
17-
exit_occurrences="$(grep -H --color=never --line-number -P '\exit\s*\(' "$@")" || true
19+
exit_occurrences="$(grep -H --color=never --line-number -P '\bexit\s*[\(;]' "$@")" || true
1820
if [ -n "$exit_occurrences" ]; then
19-
echo "exit() is not allowed!"
21+
echo "exit is not allowed! use UnitySite::die() instead."
2022
echo "$exit_occurrences"
2123
exit 1
2224
fi

0 commit comments

Comments
 (0)