mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 03:32:27 +01:00
Merge pull request #9 from adamhjk/dos_endings
Supporting DOS line endings in BATS tests
This commit is contained in:
commit
1be500e4ff
|
@ -127,7 +127,7 @@ BATS_OUT="${BATS_TMPNAME}.out"
|
||||||
|
|
||||||
bats_preprocess_source() {
|
bats_preprocess_source() {
|
||||||
BATS_TEST_SOURCE="${BATS_TMPNAME}.src"
|
BATS_TEST_SOURCE="${BATS_TMPNAME}.src"
|
||||||
bats-preprocess < "$BATS_TEST_FILENAME" > "$BATS_TEST_SOURCE"
|
tr -d '\r' < "$BATS_TEST_FILENAME" | 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
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,3 +103,8 @@ fixtures bats
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ "${lines[1]}" = "ok 1 dash-e on beginning of line" ]
|
[ "${lines[1]}" = "ok 1 dash-e on beginning of line" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "dos line endings are stripped before testing" {
|
||||||
|
run bats "$FIXTURE_ROOT/dos_line.bats"
|
||||||
|
[ $status -eq 0 ]
|
||||||
|
}
|
||||||
|
|
3
test/fixtures/bats/dos_line.bats
vendored
Normal file
3
test/fixtures/bats/dos_line.bats
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@test "foo" {
|
||||||
|
echo "foo"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user