Skip to content

Commit

Permalink
Merge branch 'feature/cat-reports' into 234-skip-summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Müller committed Jan 25, 2016
2 parents 124cd49 + ac6bb3d commit 646eb59
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions R/reporter-summary.r
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ SummaryReporter <- setRefClass("SummaryReporter", contains = "Reporter",
}
} else {
cat("\n")

reports <- vapply(seq_len(n), function(i) {
failure_summary(failures[[i]], labels[i])
}, character(1))
cat(paste(reports, collapse = "\n\n"), "\n", sep = "")
cat_reports(failures, failure_summary, "\n\n")

if (show_praise && runif(1) < 0.25) {
cat("\n", colourise(encourage(), "error"), "\n", sep = "")
Expand All @@ -111,3 +107,17 @@ SummaryReporter <- setRefClass("SummaryReporter", contains = "Reporter",
)

labels <- c(1:9, letters, LETTERS)

cat_reports <- function(reports, summary_fun, collapse) {
report_summary <- vapply(
seq_len(min(length(reports), length(labels))),
function(i) {
summary_fun(reports[[i]], labels[i])
}, character(1L))
cat(paste(report_summary, collapse = collapse), "\n", sep = "")

extra_reports <- length(reports) - length(labels)
if (extra_reports > 0L) {
cat(" ... and ", extra_reports, " more\n")
}
}

0 comments on commit 646eb59

Please sign in to comment.