Skip to content

Commit

Permalink
Tweak test; require use_package_doc()
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 14, 2023
1 parent 2e77417 commit ec385e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions R/cpp11.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use_cpp11 <- function() {
check_installed("cpp11")
check_is_package("use_cpp11()")
check_uses_roxygen("use_cpp11()")
check_has_package_doc("use_cpp11()")
use_src()

use_dependency("cpp11", "LinkingTo")
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-cpp11.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ test_that("use_cpp11() requires a package", {
test_that("use_cpp11() creates files/dirs, edits DESCRIPTION and .gitignore", {
create_local_package()
use_roxygen_md()
use_package_doc()

local_interactive(FALSE)
local_check_installed()
local_mocked_bindings(check_cpp_register_deps = function() invisible())
local_mocked_bindings(
check_cpp_register_deps = function() invisible()
# project_name = function() "testpkg"
)

use_cpp11()

Expand All @@ -23,7 +27,7 @@ test_that("use_cpp11() creates files/dirs, edits DESCRIPTION and .gitignore", {
expect_true(all(c("*.o", "*.so", "*.dll") %in% ignores))

namespace <- read_utf8(proj_path("NAMESPACE"))
expect_true("# Generated by roxygen2: do not edit by hand" %in% namespace)
expect_true(any(grepl("useDynLib", namespace)))
})

test_that("check_cpp_register_deps is silent if all installed, emits todo if not", {
Expand Down

0 comments on commit ec385e2

Please sign in to comment.