From 5e0b7b2dfa9547eb650ddfd6ccd3b810548d37a8 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 25 Jul 2024 15:28:05 -0700 Subject: [PATCH] Mock another helper that assumes cpp11 is installed --- tests/testthat/test-cpp11.R | 6 ++++++ tests/testthat/test-rcpp.R | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/tests/testthat/test-cpp11.R b/tests/testthat/test-cpp11.R index b0a487aaa..8e77637b3 100644 --- a/tests/testthat/test-cpp11.R +++ b/tests/testthat/test-cpp11.R @@ -1,5 +1,6 @@ test_that("use_cpp11() requires a package", { create_local_project() + local_check_installed() expect_usethis_error(use_cpp11(), "not an R package") }) @@ -10,6 +11,11 @@ test_that("use_cpp11() creates files/dirs, edits DESCRIPTION and .gitignore", { # pretend cpp11 is installed local_check_installed() + local_mocked_bindings( + check_cpp_register_deps = function() NULL + ) + + use_cpp11() expect_match(desc::desc_get("LinkingTo"), "cpp11") diff --git a/tests/testthat/test-rcpp.R b/tests/testthat/test-rcpp.R index 3b89af997..865854284 100644 --- a/tests/testthat/test-rcpp.R +++ b/tests/testthat/test-rcpp.R @@ -10,6 +10,10 @@ test_that("use_rcpp() creates files/dirs, edits DESCRIPTION and .gitignore", { # pretend Rcpp is installed local_check_installed() + local_mocked_bindings( + check_cpp_register_deps = function() NULL + ) + use_rcpp("test") expect_match(desc::desc_get("LinkingTo"), "Rcpp") expect_match(desc::desc_get("Imports"), "Rcpp")