Skip to content

Commit cc4d09c

Browse files
pachadotdevjennybc
andauthored
follow @jennybc advice (#1945)
* follow @jennybc advice * dont check cpp11 installed * skip test * Update cpp11.R * Update cpp11.R * jennybc comment on pr 1945 * Mock another helper that assumes cpp11 is installed * Back to how the local mocks were originally * More accurate description * Oops did not mean to touch this file --------- Co-authored-by: Jennifer (Jenny) Bryan <[email protected]>
1 parent ef3d516 commit cc4d09c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# usethis (development version)
22

3+
* `use_cpp11()` makes it easier to update `NAMESPACE` (@pachadotdev, #1921).
4+
35
* `pr_merge_main()` now offers the choice to not open the files with merge conflicts (@olivroy, #1720).
46

57
* `edit_rstudio_snippets()` now accepts yaml snippets (@olivroy, #1941).

R/cpp11.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use_cpp11 <- function() {
1212
check_is_package("use_cpp11()")
1313
check_installed("cpp11")
1414
check_uses_roxygen("use_cpp11()")
15+
check_has_package_doc("use_cpp11()")
1516
use_src()
1617

1718
use_dependency("cpp11", "LinkingTo")

tests/testthat/test-cpp11.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ test_that("use_cpp11() requires a package", {
77
test_that("use_cpp11() creates files/dirs, edits DESCRIPTION and .gitignore", {
88
create_local_package()
99
use_roxygen_md()
10+
use_package_doc() # needed for use_cpp11()
1011

1112
local_interactive(FALSE)
1213
local_check_installed()
1314
local_mocked_bindings(check_cpp_register_deps = function() invisible())
1415

1516
use_cpp11()
16-
17-
deps <- proj_deps()
18-
expect_equal(deps$type, "LinkingTo")
19-
expect_equal(deps$package, "cpp11")
17+
expect_match(desc::desc_get("LinkingTo"), "cpp11")
2018
expect_proj_dir("src")
19+
expect_proj_file("src", "code.cpp")
2120

2221
ignores <- read_utf8(proj_path("src", ".gitignore"))
2322
expect_contains(ignores, c("*.o", "*.so", "*.dll"))

0 commit comments

Comments
 (0)