Closed hadley closed 7 years ago
Basic idea:
bad_sum <- function(...) 0
val1 <- 1
val2 <- 1
exp <- 3
expect_equal(bad_sum(!!val1, !!val2), !!exp)
# Should generate same failure message as
expect_equal(bad_sum(1, 1), 3)
#> Error: bad_sum(1, 1) not equal to 3.
#> 1/1 mismatches
#> [1] 10 - 3 == 7
This is not tidy eval, but quasiquotation + quosures in order to generate better labels.
make_label()
is only exported in the dev version, so it's safe to replace.
To better support parameterised tests. Should include #524
test_that()
needs to useenquo()
andtest_code()
needs to useeval_tidy()
. Might be root cause of #616. This will also need changes totest_rd()
andtest_example()
.label()
needs to useenexpr()
andexpr_label()
(may need to port multi-line function fix from f7dd41b1)expect_*
needs toenquo()
and then immediately evaluate.