Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
Avoid expr for faster preprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
sstephenson committed Nov 17, 2013
1 parent 80815f7 commit 08374f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libexec/bats-preprocess
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ encode_name() {

tests=()
index=0
pattern='^ *@test *([^ ].*) *\{ *$'

while IFS= read -r line; do
let index+=1
quoted_name="$(expr "$line" : ' *@test *\([^ ].*\) *{ *$' || true)"

if [ -n "$quoted_name" ]; then
if [[ "$line" =~ $pattern ]]; then
quoted_name="${BASH_REMATCH[1]}"
name="$(eval echo "$quoted_name")"
encoded_name="$(encode_name "$name")"
tests["${#tests[@]}"]="$encoded_name"
Expand Down

0 comments on commit 08374f7

Please sign in to comment.