Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious warning "Arguments in ... must be used" if an error is not triggered and fixed = TRUE #2013

Closed
mcol opened this issue Nov 5, 2024 · 1 comment

Comments

@mcol
Copy link
Contributor

mcol commented Nov 5, 2024

See this testcase: as the function is not producing an error, I would expect one error to be reported:

test_that("showing problem", {
  local_edition(3)
  expect_error(identity(1),
               "Error message", fixed = TRUE)
})

Instead, besides an error I also get a warning and backtrace just because I am using fixed = TRUE:

══ Testing test_test.R ══════════════════════════════════════════════════
[ FAIL 1 | WARN 1 | SKIP 0 | PASS 0 ]

── Failure (test_test.R:3:3): showing problem ──────────────────────────────────
`identity(1)` did not throw the expected error.

── Warning (test_test.R:3:3): showing problem ──────────────────────────────────
Arguments in `...` must be used.
x Problematic argument:
* fixed = TRUE
i Did you misspell an argument name?
Backtrace:
     ▆
  1. ├─testthat::expect_error(identity(1), "Error message", fixed = TRUE) at test_test.R:3:3
  2. │ └─testthat:::expect_condition_matching(...)
  3. │   └─rlang (local) `<fn>`()
  4. │     └─rlang:::check_dots(env, error, action, call)
  5. │       └─rlang:::action_dots(...)
  6. │         ├─rlang (local) try_dots(...)
  7. │         │ └─rlang::try_fetch(expr, error = error)
  8. │         │   ├─base::tryCatch(...)
  9. │         │   │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 10. │         │   │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 11. │         │   │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 12. │         │   └─base::withCallingHandlers(...)
 13. │         └─rlang (local) action(...)
 14. │           └─rlang:::signal_abort(cnd, .file)
 15. │             └─base::signalCondition(cnd)
 16. └─rlang (local) `<fn>`(`<rlb_rr__>`)
 17.   └─handlers[[1L]](cnd)
[ FAIL 1 | WARN 1 | SKIP 0 | PASS 0 ]
@hadley
Copy link
Member

hadley commented Nov 6, 2024

Duplicate of #1932 (which should be fixed shortly)

@hadley hadley closed this as completed Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants