-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorexpectation 🙀
Description
Related: #2072.
I run this code:
pkgload::load_all()
reporter <- testthat::ListReporter$new()
testthat::test_local(reporter = reporter, stop_on_failure = FALSE)And find that for any i,j such that is.null(reporter$get_results()[[ii]]$results[[j]]$trace), the test came from expect_identical(), expect_true(), ..., or other {testthat} export.
I would have expected a trace to be generated "automatically" by {testthat}'s own functions -- am I doing something wrong?
testthat_regexes <- c(
expect_identical = "not identical to",
expect_true_false = "is not (TRUE|FALSE)",
expect_length = "has length [0-9]+",
expect_null = "is not NULL",
expect_output = "does not match.*Actual value",
NULL
)
testthat_matcher <- paste(testthat_regexes, collapse = "|")
for (test in reporter$get_results()) {
for (res in test$results) {
if (inherits(res, c("expectation_success", "expectation_skip"))) next
stopifnot("Only testthat expectations give NULL trace" =
is.null(res$trace) == grepl(testthat_matcher, res$message))
}
}(NB, I have a patch applied where our main custom tester, expect_lint(), manually supplies trace=rlang::trace_back() to all 3 calls to expect())
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorexpectation 🙀