1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-09-29 20:48:27 +02:00

exec-test: Invoke bats-preprocess directly

Also, `bats-preprocess` now converts DOS/Windows CRLF line endings.
This commit is contained in:
Mike Bland 2017-02-15 10:44:11 -05:00
parent d294689bdd
commit cf9a3b8af4
No known key found for this signature in database
GPG Key ID: 5121C73A6E07384B
2 changed files with 2 additions and 1 deletions

View File

@ -327,7 +327,7 @@ BATS_OUT="${BATS_TMPNAME}.out"
bats_preprocess_source() { bats_preprocess_source() {
BATS_TEST_SOURCE="${BATS_TMPNAME}.src" BATS_TEST_SOURCE="${BATS_TMPNAME}.src"
{ tr -d '\r' < "$BATS_TEST_FILENAME"; echo; } | bats-preprocess > "$BATS_TEST_SOURCE" . bats-preprocess <<< "$(< "$BATS_TEST_FILENAME")"$'\n' > "$BATS_TEST_SOURCE"
trap "bats_cleanup_preprocessed_source" err exit trap "bats_cleanup_preprocessed_source" err exit
trap "bats_cleanup_preprocessed_source; exit 1" int trap "bats_cleanup_preprocessed_source; exit 1" int
} }

View File

@ -34,6 +34,7 @@ index=0
pattern='^ *@test *([^ ].*) *\{ *(.*)$' pattern='^ *@test *([^ ].*) *\{ *(.*)$'
while IFS= read -r line; do while IFS= read -r line; do
line="${line//$'\r'}"
let index+=1 let index+=1
if [[ "$line" =~ $pattern ]]; then if [[ "$line" =~ $pattern ]]; then
quoted_name="${BASH_REMATCH[1]}" quoted_name="${BASH_REMATCH[1]}"