mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
Fix for test files without trailing newlines (closes #12)
This commit is contained in:
parent
02df4f53a8
commit
8930e4e0d1
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ]
|
||||||
|
|
3
test/fixtures/bats/without_trailing_newline.bats
vendored
Normal file
3
test/fixtures/bats/without_trailing_newline.bats
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@test "truth" {
|
||||||
|
true
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user