Skip to content
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

Resolve https://github.com/r-lib/pkgdown/issues/2727 #2728

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

lcolladotor
Copy link
Contributor

This commit implements the change @hadley proposed at #2727 (comment) 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.

This commit implements the change @hadley proposed at r-lib#2727 (comment) 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.
@hadley
Copy link
Member

hadley commented Jul 19, 2024

Would you mind adding a test too please?

@jayhesselberth
Copy link
Collaborator

jayhesselberth commented Jul 22, 2024

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)"))
})

@lcolladotor
Copy link
Contributor Author

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.

@jayhesselberth jayhesselberth merged commit 6f01c92 into r-lib:main Jul 23, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants