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

More descriptive message for failing line and file

This commit is contained in:
Sam Stephenson 2013-10-21 10:57:53 -05:00
parent f4e09aaa2a
commit c8c56a987c
2 changed files with 3 additions and 3 deletions

View File

@ -104,7 +104,7 @@ bats_exit_trap() {
if [ -z "$BATS_TEST_COMPLETED" ]; then if [ -z "$BATS_TEST_COMPLETED" ]; then
echo "not ok $BATS_TEST_NUMBER $BATS_TEST_DESCRIPTION" >&3 echo "not ok $BATS_TEST_NUMBER $BATS_TEST_DESCRIPTION" >&3
echo "# $BATS_TEST_FILENAME:$BATS_LINE_NUMBER" >&3 echo "# (in test file $BATS_TEST_FILENAME, line $BATS_LINE_NUMBER)" >&3
sed -e "s/^/# /" < "$BATS_OUT" >&3 sed -e "s/^/# /" < "$BATS_OUT" >&3
status=1 status=1
else else

View File

@ -39,7 +39,7 @@ fixtures 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" ]
[ ${lines[2]} = "# $FIXTURE_ROOT/failing.bats:4" ] [ ${lines[2]} = "# (in test file $FIXTURE_ROOT/failing.bats, line 4)" ]
} }
@test "one failing and one passing test" { @test "one failing and one passing test" {
@ -47,7 +47,7 @@ fixtures bats
[ $status -eq 1 ] [ $status -eq 1 ]
[ ${lines[0]} = "1..2" ] [ ${lines[0]} = "1..2" ]
[ ${lines[1]} = "not ok 1 a failing test" ] [ ${lines[1]} = "not ok 1 a failing test" ]
[ ${lines[2]} = "# $FIXTURE_ROOT/failing_and_passing.bats:2" ] [ ${lines[2]} = "# (in test file $FIXTURE_ROOT/failing_and_passing.bats, line 2)" ]
[ ${lines[3]} = "ok 2 a passing test" ] [ ${lines[3]} = "ok 2 a passing test" ]
} }