1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-09-29 12:38:26 +02:00

Test for failing tests

This commit is contained in:
Sam Stephenson 2011-12-28 19:14:10 -06:00
parent a469e8dd04
commit ac64e0b18a
3 changed files with 13 additions and 1 deletions

View File

@ -66,10 +66,12 @@ bats_exit_trap() {
bats_perform_tests() {
echo "1..$#"
test_number=1
status=0
for test_name in "$@"; do
"$0" "$BATS_TEST_FILENAME" "$test_name" "$test_number" || true
"$0" "$BATS_TEST_FILENAME" "$test_name" "$test_number" || status=1
test_number=$(($test_number + 1))
done
exit "$status"
}
bats_perform_test() {

View File

@ -26,3 +26,10 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
[ ${lines[0]} = "1..1" ]
[ ${lines[1]} = "ok 1 a passing test" ]
}
@test "one failing test" {
run bats "$FIXTURE_ROOT/one_failing.bats"
[ $status -eq 1 ]
[ ${lines[0]} = "1..1" ]
[ ${lines[1]} = "not ok 1 a failing test" ]
}

3
test/fixtures/one_failing.bats vendored Normal file
View File

@ -0,0 +1,3 @@
@test "a failing test" {
false
}