-
Notifications
You must be signed in to change notification settings - Fork 285
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
follow @jennybc advice #1945
follow @jennybc advice #1945
Conversation
R/cpp11.R
Outdated
roxygen_ns_append( | ||
sprintf("@useDynLib %s, .registration = TRUE", project_name()) | ||
) && roxygen_remind() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that use_src()
does exactly this already? Can you help me understand why use_cpp11()
needs to do that again?
Lines 74 to 75 in 93f4410
roxygen_ns_append(glue("@useDynLib {project_name()}, .registration = TRUE")) && | |
roxygen_remind() |
tests/testthat/test-cpp11.R
Outdated
skip_if_not_installed("cpp11") | ||
|
||
create_local_package() | ||
use_roxygen_md() | ||
use_package_doc() | ||
|
||
local_interactive(FALSE) | ||
local_check_installed() | ||
local_mocked_bindings(check_cpp_register_deps = function() invisible()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of skips and mocks, I would expect this to look very much like the same test for use_rcpp()
:
usethis/tests/testthat/test-rcpp.R
Lines 6 to 21 in a919437
test_that("use_rcpp() creates files/dirs, edits DESCRIPTION and .gitignore", { | |
create_local_package() | |
use_roxygen_md() | |
# pretend Rcpp is installed | |
local_check_installed() | |
use_rcpp("test") | |
expect_match(desc::desc_get("LinkingTo"), "Rcpp") | |
expect_match(desc::desc_get("Imports"), "Rcpp") | |
expect_proj_dir("src") | |
expect_proj_file("src", "test.cpp") | |
ignores <- read_utf8(proj_path("src", ".gitignore")) | |
expect_true(all(c("*.o", "*.so", "*.dll") %in% ignores)) | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to reflect this. The test "use_rcpp_armadillo() creates Makevars..." is something I can implement later for cpp11armadillo.
Whew, we got there! |
this is a new version of #1921
@jennybc I took some time to type with 1 hand and I used the logic you proposed here #1921 (comment)