mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 03:32:27 +01:00
Test for failing tests
This commit is contained in:
parent
a469e8dd04
commit
ac64e0b18a
|
@ -66,10 +66,12 @@ bats_exit_trap() {
|
||||||
bats_perform_tests() {
|
bats_perform_tests() {
|
||||||
echo "1..$#"
|
echo "1..$#"
|
||||||
test_number=1
|
test_number=1
|
||||||
|
status=0
|
||||||
for test_name in "$@"; do
|
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))
|
test_number=$(($test_number + 1))
|
||||||
done
|
done
|
||||||
|
exit "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
bats_perform_test() {
|
bats_perform_test() {
|
||||||
|
|
|
@ -26,3 +26,10 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
|
||||||
[ ${lines[0]} = "1..1" ]
|
[ ${lines[0]} = "1..1" ]
|
||||||
[ ${lines[1]} = "ok 1 a passing test" ]
|
[ ${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
3
test/fixtures/one_failing.bats
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@test "a failing test" {
|
||||||
|
false
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user