diff --git a/libexec/bats-exec-test b/libexec/bats-exec-test index 13de84f..fe65997 100755 --- a/libexec/bats-exec-test +++ b/libexec/bats-exec-test @@ -172,7 +172,7 @@ BATS_OUT="${BATS_TMPNAME}.out" bats_preprocess_source() { BATS_TEST_SOURCE="${BATS_TMPNAME}.src" - tr -d '\r' < "$BATS_TEST_FILENAME" | bats-preprocess > "$BATS_TEST_SOURCE" + { tr -d '\r' < "$BATS_TEST_FILENAME"; echo; } | bats-preprocess > "$BATS_TEST_SOURCE" trap bats_cleanup_preprocessed_source err exit trap "bats_cleanup_preprocessed_source; exit 1" int } diff --git a/test/bats.bats b/test/bats.bats index 2cc13e3..b408839 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -117,6 +117,12 @@ fixtures bats [ $status -eq 0 ] } +@test "test file without trailing newline" { + run bats "$FIXTURE_ROOT/without_trailing_newline.bats" + [ $status -eq 0 ] + [ "${lines[1]}" = "ok 1 truth" ] +} + @test "skipped tests" { run bats "$FIXTURE_ROOT/skipped.bats" [ $status -eq 0 ] diff --git a/test/fixtures/bats/without_trailing_newline.bats b/test/fixtures/bats/without_trailing_newline.bats new file mode 100644 index 0000000..e3ace8b --- /dev/null +++ b/test/fixtures/bats/without_trailing_newline.bats @@ -0,0 +1,3 @@ +@test "truth" { + true +} \ No newline at end of file