From 932989cc0f1836ef1498c8fe755164f61d03bc35 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 30 Nov 2023 08:11:03 -0600 Subject: [PATCH] Ensure that extra args generate a warning, not an error And re-run revdeps --- R/expect-condition.R | 7 +++- revdep/README.md | 6 +++ revdep/cran.md | 12 +++++- revdep/problems.md | 49 ++++++++++++++++++++++- tests/testthat/_snaps/expect-condition.md | 11 +++++ tests/testthat/test-expect-condition.R | 4 ++ 6 files changed, 84 insertions(+), 5 deletions(-) diff --git a/R/expect-condition.R b/R/expect-condition.R index da927523e..7bf2395d4 100644 --- a/R/expect-condition.R +++ b/R/expect-condition.R @@ -254,8 +254,11 @@ expect_condition_matching <- function(base_class, inherit = TRUE, info = NULL, label = NULL, - trace_env = caller_env()) { - check_dots_used(error = warning) + trace_env = caller_env(), + error_call = caller_env()) { + check_dots_used(error = function(cnd) { + warn(conditionMessage(cnd), call = error_call) + }) matcher <- cnd_matcher( base_class, diff --git a/revdep/README.md b/revdep/README.md index 52e12c714..a1c9ff597 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,2 +1,8 @@ # Revdeps +## New problems (1) + +|package |version |error |warning |note | +|:--------|:-------|:------|:-------|:----| +|[APCalign](problems.md#apcalign)|0.1.3 |__+1__ | |1 | + diff --git a/revdep/cran.md b/revdep/cran.md index 5fe91620c..e96943212 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,7 +1,15 @@ ## revdepcheck results -We checked 15 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 10 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. - * We saw 0 new problems + * We saw 1 new problems * We failed to check 0 packages +Issues with CRAN packages are summarised below. + +### New problems +(This reports the first line of each new failure) + +* APCalign + checking tests ... ERROR + diff --git a/revdep/problems.md b/revdep/problems.md index 9a2073633..c2bf65032 100644 --- a/revdep/problems.md +++ b/revdep/problems.md @@ -1 +1,48 @@ -*Wow, no problems at all. :)* \ No newline at end of file +# APCalign + +
+ +* Version: 0.1.3 +* GitHub: https://github.com/traitecoevo/APCalign +* Source code: https://github.com/cran/APCalign +* Date/Publication: 2023-11-16 22:43:53 UTC +* Number of recursive dependencies: 97 + +Run `revdepcheck::cloud_details(, "APCalign")` for more info + +
+ +## Newly broken + +* checking tests ... ERROR + ``` + Running ‘testthat.R’ + Running the tests in ‘tests/testthat.R’ failed. + Complete output: + > # This file is part of the standard setup for testthat. + > # It is recommended that you do not modify it. + > # + > # Where should you do additional test configuration? + > # Learn more about the roles of various files in: + > # * https://r-pkgs.org/tests.html + > # * https://testthat.r-lib.org/reference/test_package.html#special-files + ... + 6. │ └─dplyr:::check_nth_default(default, x = x) + 7. │ └─vctrs::vec_init(x) + 8. └─vctrs:::stop_scalar_type(``(NULL), "x", ``(vec_init())) + 9. └─vctrs:::stop_vctrs(...) + 10. └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call) + + [ FAIL 1 | WARN 0 | SKIP 0 | PASS 85 ] + Error: Test failures + In addition: There were 18 warnings (use warnings() to see them) + Execution halted + ``` + +## In both + +* checking data for non-ASCII characters ... NOTE + ``` + Note: found 4 marked UTF-8 strings + ``` + diff --git a/tests/testthat/_snaps/expect-condition.md b/tests/testthat/_snaps/expect-condition.md index c90eac682..474850cfe 100644 --- a/tests/testthat/_snaps/expect-condition.md +++ b/tests/testthat/_snaps/expect-condition.md @@ -25,3 +25,14 @@ Message: dispatched! Class: foobar/rlang_error/error/condition +# unused arguments generate a warning + + Code + expect_condition(stop("Hi!"), foo = "bar") + Condition + Warning in `expect_condition()`: + Arguments in `...` must be used. + x Problematic argument: + * foo = "bar" + i Did you misspell an argument name? + diff --git a/tests/testthat/test-expect-condition.R b/tests/testthat/test-expect-condition.R index 814f3c67b..f09276889 100644 --- a/tests/testthat/test-expect-condition.R +++ b/tests/testthat/test-expect-condition.R @@ -212,6 +212,10 @@ test_that("can match parent conditions (#1493)", { expect_error(expect_error(f(), "Parent message.", inherit = FALSE)) }) +test_that("unused arguments generate a warning", { + expect_snapshot(expect_condition(stop("Hi!"), foo = "bar")) +}) + # second edition ----------------------------------------------------------