From 7cec3d6259a938e799af5bdbd4e6befd8a1d8c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohnic=CC=81?= Date: Sat, 6 Apr 2013 14:01:03 +0200 Subject: [PATCH] fix preprocessing tests that have lines beginning with -e --- libexec/bats-preprocess | 2 +- test/bats.bats | 6 ++++++ test/fixtures/bats/intact.bats | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/bats/intact.bats 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 - <