Skip to content

Commit

Permalink
Add a test specifically for tidyverse#6261 and tidyverse#6206
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Jun 1, 2022
1 parent e44b9ab commit 0e44aed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/_snaps/case-when.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
Error:
! Case 1 (`!!!fs`) must be a two-sided formula, not a call.

# invalid type errors are correct (#6261) (#6206)

Code
case_when(TRUE ~ 1, TRUE ~ "x")
Condition
Error in `case_when()`:
! Can't combine `TRUE ~ 1` <double> and `TRUE ~ "x"` <character>.

# trying to mix the old interface with new arguments isn't allowed

Code
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-case-when.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ test_that("doesn't support quosures in the new interface", {
})
})

test_that("invalid type errors are correct (#6261) (#6206)", {
expect_snapshot(error = TRUE, {
case_when(TRUE ~ 1, TRUE ~ "x")
})
})

test_that("trying to mix the old interface with new arguments isn't allowed", {
expect_snapshot(error = TRUE, case_when(1 ~ 2, .default = 3))
expect_snapshot(error = TRUE, case_when(1 ~ 2, .ptype = integer()))
Expand Down

0 comments on commit 0e44aed

Please sign in to comment.