When I ran the code below interactively, I got the following warning:
Error: 1 did not throw the expected warning.
Warning in expect_warning(1, regexp = "foo", fixed = TRUE) :
Arguments in `...` must be used.
✖ Problematic argument:
• fixed = TRUE
ℹ Did you misspell an argument name?
But when run in reprex, I don't see the warning about fixed. Why is there different behavior for interactive vs non-interactive use for argument matching?
library(testthat)
expect_message(
message("foo"),
regexp = "foo",
fixed = TRUE
)
expect_message(
1,
regexp = "foo",
fixed = TRUE
)
#> Error: 1 did not produce any messages.
expect_warning(
warning("foo"),
regexp = "foo",
fixed = TRUE
)
expect_warning(
1,
regexp = "foo",
fixed = TRUE
)
#> Error: 1 did not produce any warnings.
expect_error(
stop("foo"),
regexp = "foo",
fixed = TRUE
)
expect_error(
1,
regexp = "foo",
fixed = TRUE
)
#> Error: 1 did not throw an error.
When I ran the code below interactively, I got the following warning:
But when run in reprex, I don't see the warning about
fixed
. Why is there different behavior for interactive vs non-interactive use for argument matching?Created on 2024-02-15 with reprex v2.1.0