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

rlang error with `... %>% expect_warning() #1994

Open
krlmlr opened this issue Oct 9, 2024 · 0 comments
Open

rlang error with `... %>% expect_warning() #1994

krlmlr opened this issue Oct 9, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior conditions

Comments

@krlmlr
Copy link
Member

krlmlr commented Oct 9, 2024

  • Can't run in reprex, have to create a file with the contents and source it
  • expect_warning(expect_error(...)) doesn't seem to exhibit this behavior

Perhaps related: #1646

library(testthat)
test_that("boo", {
  expect_error(stop("oops")) %>%
    expect_warning()
})
> library(testthat)

> test_that("boo", {
+   expect_error(stop("oops")) %>%
+     expect_warning()
+ })
-- Error: boo ------------------------------------------------------------------
Error in `trace_back(top = getOption("testthat_topenv"), bottom = trace_env)`: Can't find `bottom` on the call tree.
Backtrace:
    x
 1. +-expect_error(stop("oops")) %>% expect_warning() at ~/.active-rstudio-document:3:3
 2. \-testthat::expect_warning(.)
 3.   \-testthat:::expect_condition_matching(...)
 4.     \-testthat::expect(...)
 5.       \-rlang::trace_back(top = getOption("testthat_topenv"), bottom = trace_env)
 6.         \-rlang:::trace_find_bottom(bottom, frames)
 7.           \-rlang::abort(msg, call = call)

Error:
! Test failed
Backtrace:
 1. base::source("~/.active-rstudio-document", echo = TRUE)
 7. reporter$stop_if_needed()
@hadley hadley added bug an unexpected problem or unintended behavior conditions labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior conditions
Projects
None yet
Development

No branches or pull requests

2 participants