Skip to content

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

@mcol

Description

@mcol

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 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions