-
Notifications
You must be signed in to change notification settings - Fork 318
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
all=
argument for expect_true()
/expect_false()
#1836
Comments
I think I'd something more like Maybe |
all=
argument for expect_true()
/expect_false()
Agree it collides too much with
Nice! That makes sense. Though I'm not sure there's anything so slick for |
I like required, but last night it occurred to me that Agree that there's no obvious |
expect_true(all(.))
is a very common construction. Here's >10,000 hits on GitHub:https://github.com/search?q=%22expect_true%28all%28%22&type=code
I propose adding
all=
as an argument toexpect_true()
. The advantage is thattestthat
can offer a better test failure interface than is currently available.Compare:
Not very helpful (NB: this is the same in 2e and 3e as of now). Proposed interface:
I don't see this as often for
expect_false(all(.))
, but for consistency we could add the argument there. We could also add anany=
argument to handleexpect_true(any(.))
, which is not uncommon, though maybe it's better served with something similar toexpect_match
:all = TRUE
--> requireall()
,all = FALSE
--> requireany()
,all = NULL
--> current behavior, i.e. requireidentical(., TRUE)
.For reference, this was triggered in particular by glancing through logs to try and debug this:
topepo/caret#1345
Our logs showing the current failure makes it a lot harder to think about what might be going wrong without actively debugging.
The text was updated successfully, but these errors were encountered: