1
0
mirror of https://github.com/sstephenson/bats.git synced 2026-02-25 09:18:10 +01:00

Pretty test output for terminals

This commit is contained in:
Sam Stephenson
2013-10-21 12:03:45 -05:00
parent b0606bc8cd
commit a3229efbfa
4 changed files with 292 additions and 39 deletions

View File

@@ -6,7 +6,7 @@ fixtures bats
@test "no arguments prints usage instructions" {
run bats
[ $status -eq 1 ]
[ $(expr "${lines[1]}" : "usage:") -ne 0 ]
[ $(expr "${lines[1]}" : "Usage:") -ne 0 ]
}
@test "-v and --version print version number" {
@@ -15,6 +15,12 @@ fixtures bats
[ $(expr "$output" : "Bats [0-9][0-9.]*") -ne 0 ]
}
@test "-h and --help print help" {
run bats -h
[ $status -eq 0 ]
[ "${#lines[@]}" -gt 3 ]
}
@test "invalid filename prints an error" {
run bats nonexistent
[ $status -eq 1 ]
@@ -126,3 +132,15 @@ fixtures bats
[ "${lines[4]}" = "begin 2 a passing test" ]
[ "${lines[5]}" = "ok 2 a passing test" ]
}
@test "pretty and tap formats" {
run bats --tap "$FIXTURE_ROOT/passing.bats"
tap_output="$output"
[ $status -eq 0 ]
run bats --pretty "$FIXTURE_ROOT/passing.bats"
pretty_output="$output"
[ $status -eq 0 ]
[ "$tap_output" != "$pretty_output" ]
}