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

Add skipped count tests in the summary

This also update the behaviour of the summary, now it only display the
number of failures, and skipped tests also, if the numbers are greater
than zero.
This commit is contained in:
Henrique Moody
2013-10-30 22:10:00 -02:00
committed by Ross Duggan
parent 2c6fed1838
commit 3be82466a7
6 changed files with 64 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ if [[ "$header" =~ $header_pattern ]]; then
count="${header:3}"
index=0
failures=0
skipped=0
name=""
count_column_width=$(( ${#count} * 2 + 2 ))
else
@@ -64,9 +65,15 @@ log() {
}
summary() {
printf "\n%d test%s, %d failure%s\n" \
"$count" "$(plural "$count")" \
"$failures" "$(plural "$failures")"
printf "\n%d test%s" "$count" "$(plural "$count")"
printf ", %d failure%s" "$failures" "$(plural "$failures")"
if [ "$skipped" -gt 0 ]; then
printf ", %d skipped" "$skipped"
fi
printf "\n"
}
printf_with_truncation() {
@@ -139,6 +146,7 @@ while IFS= read -r line; do
"ok "* )
skip_expr="ok $index # skip (\(([^)]*)\))?"
if [[ "$line" =~ $skip_expr ]]; then
let skipped+=1
buffer skip "${BASH_REMATCH[2]}"
else
buffer pass