1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-11-17 03:32:27 +01:00

Fix for test files without trailing newlines (closes #12)

This commit is contained in:
Sam Stephenson 2013-10-21 12:45:49 -05:00
parent 02df4f53a8
commit 8930e4e0d1
3 changed files with 10 additions and 1 deletions

View File

@ -172,7 +172,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" | 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 err exit
trap "bats_cleanup_preprocessed_source; exit 1" int trap "bats_cleanup_preprocessed_source; exit 1" int
} }

View File

@ -117,6 +117,12 @@ fixtures bats
[ $status -eq 0 ] [ $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" { @test "skipped tests" {
run bats "$FIXTURE_ROOT/skipped.bats" run bats "$FIXTURE_ROOT/skipped.bats"
[ $status -eq 0 ] [ $status -eq 0 ]

View File

@ -0,0 +1,3 @@
@test "truth" {
true
}