testthat
testthat copied to clipboard
expect_snapshot() fails when names contain backquotes
When running such test:
test_that("backquotes", {
expect_snapshot(
c("`a`" = 1)
)
})
I get :
`c(`\`a\`` = 2)` threw an unexpected error.
Message: attempt to use zero-length variable name
Class: simpleError/error/condition
This looks like an rlang bug: https://github.com/r-lib/rlang/issues/1642
However maybe we should just use deparse() instead of expr_deparse().
I tried using deparse() instead of expr_deparse() and I definitely did like the output (and it's likely to affect a bunch of existing snapshots). So we'll need to fix this in rlang.