Closed lcolladotor closed 4 months ago
Would you mind adding a test too please?
I think you can just test the usage2text
helper, which throws the same error in the current version. FWIW, foo()()
is fine.
library(pkgdown)
pkgdown:::usage2text("viridisLite::viridis(21)")
#> Error in is_call(x) && !is_call(x, "=") && !is_syntactic(x[[1]]): 'length = 3' in coercion to 'logical(1)'
pkgdown:::usage2text("foo()()")
#> [1] "foo()()"
Created on 2024-07-22 with reprex v2.1.1
So you could add this test to tests/testthat/test-usage.R
:
test_that("usage2text can parse symbols (#2727)", {
expect_no_error(usage2text("viridisLite::viridis(21)"))
})
Thanks @jayhesselberth!
I added the test you proposed to tests/testthat/test-usage.R
. I put it at the end of "Reference index" section of tests, though you might decide that it fits better elsewhere.
This commit implements the change @hadley proposed at https://github.com/r-lib/pkgdown/issues/2727#issuecomment-2233517302 to the internal function
needs_tweak()
. This does resolve the small reproducible example I described, though I ignore if there are other situations where it wouldn't work for.