Skip to content

Commit

Permalink
Can 'save_gcae_setup' to any folder
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Mar 30, 2022
1 parent 15f450e commit 46698bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/save_gcae_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ save_gcae_setup <- function(
parameter = names(gcae_setup),
value = as.character(unlist(gcae_setup))
)
dir.create(
dirname(gcae_setup_filename),
recursive = TRUE,
showWarnings = FALSE
)
readr::write_csv(x = t, file = gcae_setup_filename)
invisible(gcae_setup)
}
14 changes: 14 additions & 0 deletions tests/testthat/test-save_gcae_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ test_that("use", {
expect_true(file.exists(gcae_setup_filename))
file.remove(gcae_setup_filename)
})

test_that("sub-sub-sub folder", {
gcae_setup <- create_test_gcae_setup()
gcae_setup_filename <- file.path(
get_gcaer_tempfilename(),
"sub", "sub", "file.csv"
)
save_gcae_setup(
gcae_setup = gcae_setup,
gcae_setup_filename = gcae_setup_filename
)
expect_true(file.exists(gcae_setup_filename))
file.remove(gcae_setup_filename)
})

0 comments on commit 46698bc

Please sign in to comment.