mirror of
https://github.com/sstephenson/bats.git
synced 2024-12-26 06:29:47 +01:00
parent
d2c5b9ef71
commit
25505bd143
|
@ -4,12 +4,20 @@ set -e
|
||||||
# Just stream the TAP output (sans extended syntax) if tput is missing
|
# Just stream the TAP output (sans extended syntax) if tput is missing
|
||||||
command -v tput >/dev/null || exec grep -v "^begin "
|
command -v tput >/dev/null || exec grep -v "^begin "
|
||||||
|
|
||||||
IFS= read -r header # 1..n
|
header_pattern='[0-9]+\.\.[0-9]+'
|
||||||
count="${header:3}"
|
IFS= read -r header
|
||||||
index=0
|
|
||||||
failures=0
|
if [[ "$header" =~ $header_pattern ]]; then
|
||||||
name=""
|
count="${header:3}"
|
||||||
count_column_width=$(( ${#count} * 2 + 2 ))
|
index=0
|
||||||
|
failures=0
|
||||||
|
name=""
|
||||||
|
count_column_width=$(( ${#count} * 2 + 2 ))
|
||||||
|
else
|
||||||
|
# If the first line isn't a TAP plan, print it and pass the rest through
|
||||||
|
printf "%s\n" "$header"
|
||||||
|
exec cat
|
||||||
|
fi
|
||||||
|
|
||||||
update_screen_width() {
|
update_screen_width() {
|
||||||
screen_width="$(tput cols)"
|
screen_width="$(tput cols)"
|
||||||
|
|
|
@ -150,3 +150,10 @@ fixtures bats
|
||||||
|
|
||||||
[ "$tap_output" != "$pretty_output" ]
|
[ "$tap_output" != "$pretty_output" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "pretty formatter bails on invalid tap" {
|
||||||
|
run bats --tap "$FIXTURE_ROOT/invalid_tap.bats"
|
||||||
|
[ $status -eq 1 ]
|
||||||
|
[ "${lines[0]}" = "This isn't TAP!" ]
|
||||||
|
[ "${lines[1]}" = "Good day to you" ]
|
||||||
|
}
|
||||||
|
|
7
test/fixtures/bats/invalid_tap.bats
vendored
Normal file
7
test/fixtures/bats/invalid_tap.bats
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
echo "This isn't TAP!"
|
||||||
|
echo "Good day to you"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
@test "truth" {
|
||||||
|
true
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user