mirror of
https://github.com/sstephenson/bats.git
synced 2026-04-24 00:57:23 +02:00
Avoid expr for faster preprocessing
This commit is contained in:
@@ -31,12 +31,12 @@ encode_name() {
|
|||||||
|
|
||||||
tests=()
|
tests=()
|
||||||
index=0
|
index=0
|
||||||
|
pattern='^ *@test *([^ ].*) *\{ *$'
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
let index+=1
|
let index+=1
|
||||||
quoted_name="$(expr "$line" : ' *@test *\([^ ].*\) *{ *$' || true)"
|
if [[ "$line" =~ $pattern ]]; then
|
||||||
|
quoted_name="${BASH_REMATCH[1]}"
|
||||||
if [ -n "$quoted_name" ]; then
|
|
||||||
name="$(eval echo "$quoted_name")"
|
name="$(eval echo "$quoted_name")"
|
||||||
encoded_name="$(encode_name "$name")"
|
encoded_name="$(encode_name "$name")"
|
||||||
tests["${#tests[@]}"]="$encoded_name"
|
tests["${#tests[@]}"]="$encoded_name"
|
||||||
|
|||||||
Reference in New Issue
Block a user