From cf9a3b8af4a8bbb6246e321f687d89e5f654fb57 Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Wed, 15 Feb 2017 10:44:11 -0500 Subject: [PATCH] exec-test: Invoke bats-preprocess directly Also, `bats-preprocess` now converts DOS/Windows CRLF line endings. --- libexec/bats-exec-test | 2 +- libexec/bats-preprocess | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/bats-exec-test b/libexec/bats-exec-test index 7e86c16..09e8a7f 100755 --- a/libexec/bats-exec-test +++ b/libexec/bats-exec-test @@ -327,7 +327,7 @@ BATS_OUT="${BATS_TMPNAME}.out" bats_preprocess_source() { 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; exit 1" int } diff --git a/libexec/bats-preprocess b/libexec/bats-preprocess index 04297ed..873085e 100755 --- a/libexec/bats-preprocess +++ b/libexec/bats-preprocess @@ -34,6 +34,7 @@ index=0 pattern='^ *@test *([^ ].*) *\{ *(.*)$' while IFS= read -r line; do + line="${line//$'\r'}" let index+=1 if [[ "$line" =~ $pattern ]]; then quoted_name="${BASH_REMATCH[1]}"