diff --git a/tests/testthat/_snaps/case-when.md b/tests/testthat/_snaps/case-when.md index 177e929546..1741efeec3 100644 --- a/tests/testthat/_snaps/case-when.md +++ b/tests/testthat/_snaps/case-when.md @@ -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` and `TRUE ~ "x"` . + # trying to mix the old interface with new arguments isn't allowed Code diff --git a/tests/testthat/test-case-when.R b/tests/testthat/test-case-when.R index df8b7047e3..a6086dfae9 100644 --- a/tests/testthat/test-case-when.R +++ b/tests/testthat/test-case-when.R @@ -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()))