1
0
mirror of https://github.com/sstephenson/bats.git synced 2026-02-26 01:38:11 +01:00

Print test file path and line number after a failing test

This commit is contained in:
Sam Stephenson
2013-05-23 12:47:17 -05:00
parent 1be500e4ff
commit bc72b85871
3 changed files with 35 additions and 9 deletions

View File

@@ -39,6 +39,7 @@ fixtures bats
[ $status -eq 1 ]
[ ${lines[0]} = "1..1" ]
[ ${lines[1]} = "not ok 1 a failing test" ]
[ ${lines[2]} = "# $FIXTURE_ROOT/failing.bats:4" ]
}
@test "one failing and one passing test" {
@@ -46,7 +47,8 @@ fixtures bats
[ $status -eq 1 ]
[ ${lines[0]} = "1..2" ]
[ ${lines[1]} = "not ok 1 a failing test" ]
[ ${lines[2]} = "ok 2 a passing test" ]
[ ${lines[2]} = "# $FIXTURE_ROOT/failing_and_passing.bats:2" ]
[ ${lines[3]} = "ok 2 a passing test" ]
}
@test "test environments are isolated" {
@@ -83,9 +85,9 @@ fixtures bats
@test "output is discarded for passing tests and printed for failing tests" {
run bats "$FIXTURE_ROOT/output.bats"
[ $status -eq 1 ]
[ "${lines[4]}" = " failure stdout 1" ]
[ "${lines[5]}" = " failure stdout 2" ]
[ "${lines[7]}" = " failure stderr" ]
[ "${lines[5]}" = "# failure stdout 1" ]
[ "${lines[6]}" = "# failure stdout 2" ]
[ "${lines[9]}" = "# failure stderr" ]
}
@test "-c prints the number of tests" {

View File

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