Skip to content

Conversation

snystrom
Copy link

Adds required argument to expect_true() that accepts c("one", "any", "all"). I've held off implementing for expect_false until we make sure the implementation is sound for easier review. This also means the docstring is slightly out of sync between expect_true and expect_false for now (and indeed the language could be a little nicer--I expect to polish this up too once we're aligned on the approach).

When required = "any" we throw an error to avoid edges with numeric vectors that contain 1 which may be coerced to TRUE.

Fixes #1836.

Adds `required` argument to `expect_true()` that accepts `c("one", "any", "all")`. I've held off implementing for `expect_false` until we make sure the implementation is sound for easier review.

When `required = "any"` we throw an error to avoid edges with numeric vectors that contain `1` which may be coerced to `TRUE`.

Fixes r-lib#1836.
@hadley
Copy link
Member

hadley commented Oct 2, 2025

Thanks for working on this! I'll take it from here 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

all= argument for expect_true()/expect_false()
2 participants