diff --git a/libexec/bats-preprocess b/libexec/bats-preprocess index 55406b4..7ba3132 100755 --- a/libexec/bats-preprocess +++ b/libexec/bats-preprocess @@ -42,7 +42,7 @@ while IFS= read -r line; do tests["${#tests[@]}"]="$encoded_name" echo "${encoded_name}() { bats_test_info ${quoted_name} ${index}" else - echo "$line" + printf "%s\n" "$line" fi done diff --git a/test/bats.bats b/test/bats.bats index cdafe8b..ba53ee7 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -97,3 +97,9 @@ fixtures bats [ $status -eq 0 ] [ "$output" = "4" ] } + +@test "dash-e is not mangled on beginning of line" { + run bats "$FIXTURE_ROOT/intact.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = "ok 1 dash-e on beginning of line" ] +} diff --git a/test/fixtures/bats/intact.bats b/test/fixtures/bats/intact.bats new file mode 100644 index 0000000..c25c28c --- /dev/null +++ b/test/fixtures/bats/intact.bats @@ -0,0 +1,6 @@ +@test "dash-e on beginning of line" { + run cat - <