From fcefd6fa205e4873e9f3e1864d911bef38da9b35 Mon Sep 17 00:00:00 2001 From: Rodrigo Basa Date: Fri, 9 Aug 2024 14:21:54 +0800 Subject: [PATCH] a test environment set up that seems to work --- tests/testthat/helper-utils.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/testthat/helper-utils.R b/tests/testthat/helper-utils.R index e37a58d..b07d263 100644 --- a/tests/testthat/helper-utils.R +++ b/tests/testthat/helper-utils.R @@ -17,8 +17,15 @@ expect_equivalent <- function(x, y) { language_client <- function(working_dir = getwd(), diagnostics = FALSE, capabilities = NULL) { withr::local_dir(working_dir) withr::local_file(".Rprofile", { + parser_code <- c( + "box_use_parser <-", + deparse(box_use_parser) + ) + write(parser_code, ".Rprofile", append = TRUE) + rprofile <- readLines(fs::path_package("box.lsp", "Rprofile.R")) - writeLines(rprofile, ".Rprofile") + rprofile <- sub("box.lsp::", "", rprofile) + write(rprofile, ".Rprofile", append = TRUE) readLines(".Rprofile") })