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

Test failing and passing in the same file

This commit is contained in:
Sam Stephenson 2011-12-28 20:06:05 -06:00
parent ac64e0b18a
commit 2e52aeff5d
4 changed files with 17 additions and 2 deletions

View File

@ -21,15 +21,23 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
} }
@test "one passing test" { @test "one passing test" {
run bats "$FIXTURE_ROOT/one_passing.bats" run bats "$FIXTURE_ROOT/passing.bats"
[ $status -eq 0 ] [ $status -eq 0 ]
[ ${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" { @test "one failing test" {
run bats "$FIXTURE_ROOT/one_failing.bats" run bats "$FIXTURE_ROOT/failing.bats"
[ $status -eq 1 ] [ $status -eq 1 ]
[ ${lines[0]} = "1..1" ] [ ${lines[0]} = "1..1" ]
[ ${lines[1]} = "not ok 1 a failing test" ] [ ${lines[1]} = "not ok 1 a failing test" ]
} }
@test "one failing and one passing test" {
run bats "$FIXTURE_ROOT/failing_and_passing.bats"
[ $status -eq 1 ]
[ ${lines[0]} = "1..2" ]
[ ${lines[1]} = "not ok 1 a failing test" ]
[ ${lines[2]} = "ok 2 a passing test" ]
}

View File

@ -0,0 +1,7 @@
@test "a failing test" {
false
}
@test "a passing test" {
true
}