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

Use quasiquotation #626

hadley opened this Issue Oct 1, 2017 · 2 comments


None yet
1 participant

hadley commented Oct 1, 2017

To better support parameterised tests. Should include #524

  • test_that() needs to use enquo() and test_code() needs to use eval_tidy(). Might be root cause of #616. This will also need changes to test_rd() and test_example().

  • label() needs to use enexpr() and expr_label() (may need to port multi-line function fix from f7dd41b)

  • expect_* needs to enquo() and then immediately evaluate.


This comment has been minimized.


hadley commented Oct 4, 2017

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.


This comment has been minimized.


hadley commented Oct 6, 2017

make_label() is only exported in the dev version, so it's safe to replace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment