-
Notifications
You must be signed in to change notification settings - Fork 316
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
Extract helpers for expect_equals? #482
Comments
But this isn't particularly elegant because it requires special casing equality tests. You can almost already handle this problem with the tee pipe: library(testthat)
library(magrittr)
x <- list(
a = 1,
b = 2
)
x %>%
expect_type("list") %T>%
{expect_equal(.$a, 1)} %T>%
{expect_equal(.$b, 2)} But it's not particularly elegant. Ideally, the tree structure of the testing code would reflect the tree structure of the object. |
Or maybe: x %>%
expect_type("list") %>%
tee(
expect_equal(.$a, 1),
expect_equal(.$b, 2)
) |
This looks very similar to what |
Also, wouldn't we want to use something like
(and optionally omit |
I don't think so - |
i.e.
expect_attr_equal()
,expect_element_equal()
,expect_slot_equal()
.This would let you do quick equality tests in a pipe for subcomponents. If you wanted to test for other things, you'd still need to manually extract
The text was updated successfully, but these errors were encountered: