Skip to content

Commit 8845808

Browse files
Now the test code is displayed if there is a check error
1 parent 7d80823 commit 8845808

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: future.tests
22
Title: Test Suite for 'Future API' Backends
3-
Version: 0.8.0-9000
3+
Version: 0.8.0-9001
44
Authors@R: c(
55
person("Henrik", "Bengtsson", role = c("aut", "cre", "cph"), email = "[email protected]"),
66
person(family = "The R Consortium", comment = "Project was awared an Infrastructure Steering Committee (ISC) grant in 2017", role = "fnd"))

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Version (development version)
22

3-
* ...
3+
## New Features
4+
5+
* Now the test code is displayed if there is a check error.
46

57

68
# Version 0.8.0 [2024-03-31]

R/check_plan.R

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,28 @@ check_plan <- function(tests = test_db(), defaults = list(), timeout = getOption
106106
args <- as.list(sets_of_args[aa, , drop = FALSE])
107107
args_tag <- paste(sprintf("%s=%s", names(args), unlist(args)), collapse = ", ")
108108
msg <- NULL
109-
if (status[aa] == "OK") {
109+
if (status[aa] == "OK") {
110110
cat(sprintf(" %s %s\n", ok, args_tag))
111-
total["OK"] <- total["OK"] + 1L
112-
} else if (status[aa] == "ERROR") {
111+
total["OK"] <- total["OK"] + 1L
112+
} else if (status[aa] == "ERROR") {
113113
cat(sprintf(" %s %s\n", error, args_tag))
114-
total["ERROR"] <- total["ERROR"] + 1L
115-
result <- test_results[[tt]][[aa]]
116-
ex <- result$error
114+
total["ERROR"] <- total["ERROR"] + 1L
115+
result <- test_results[[tt]][[aa]]
116+
ex <- result$error
117117
msg <- c(sprintf("Error of class %s with message:", sQuote(class(ex)[1])),
118118
conditionMessage(ex))
119119
call <- conditionCall(ex)
120-
if (length(call) > 0) msg <- c(msg, "Call:", deparse(call))
121-
if (length(result$output) > 0) msg <- c(msg, "Output:", result$output)
122-
} else if (status[aa] == "SKIP") {
120+
if (length(call) > 0) msg <- c(msg, "Call:", deparse(call))
121+
code <- paste(deparse(test$expr), collapse = "\n")
122+
msg <- c(msg, "Test code:", code)
123+
if (length(result$output) > 0) msg <- c(msg, "Output:", result$output)
124+
} else if (status[aa] == "SKIP") {
123125
cat(sprintf(" %s %s\n", skip, args_tag))
124-
total["SKIP"] <- total["SKIP"] + 1L
126+
total["SKIP"] <- total["SKIP"] + 1L
125127
msg <- conditionMessage(test_results[[tt]][[aa]]$skipped)
126-
} else if (status[aa] == "TIMEOUT") {
128+
} else if (status[aa] == "TIMEOUT") {
127129
cat(sprintf(" %s %s %s\n", timeout_error, args_tag, yellow(sprintf("(> %s)", pretty_sec(timeout)))))
128-
total["TIMEOUT"] <- total["TIMEOUT"] + 1L
130+
total["TIMEOUT"] <- total["TIMEOUT"] + 1L
129131
}
130132

131133
if (is.character(msg) && length(msg) > 0L && any(nzchar(msg) > 0L)) {

0 commit comments

Comments
 (0)