diff --git a/R/metadata.R b/R/metadata.R index beb42f79..47499771 100644 --- a/R/metadata.R +++ b/R/metadata.R @@ -342,10 +342,11 @@ static_orderly_dependency <- function(args) { ##' rely on the ordering where directory expansion was performed. ##' ##' @export -orderly_shared_resource <- function(..., envir=parent.frame()) { - files <- validate_file_from_to(list(...), envir, - name="arguments to 'orderly_shared_resource'", - call=environment()) +orderly_shared_resource <- function(...) { + files <- validate_file_from_to( + list(...), parent.frame(), + name = "arguments to 'orderly_shared_resource'", + call = environment()) if (nrow(files) == 0) { cli::cli_abort("'orderly_shared_resource' requires at least one argument", diff --git a/tests/testthat/test-run.R b/tests/testthat/test-run.R index 765161af..dcad6f34 100644 --- a/tests/testthat/test-run.R +++ b/tests/testthat/test-run.R @@ -298,18 +298,22 @@ test_that("can validate shared resource arguments", { expect_error( orderly_shared_resource(a = "A", a = "B"), - "Every destination filename (in 'arguments to 'orderly_shared_resource'') must be unique", - fixed=TRUE) + paste("Every destination filename (in 'arguments to", + "'orderly_shared_resource'') must be unique"), + fixed = TRUE) expect_error( orderly_shared_resource("a", "a"), - "Every destination filename (in 'arguments to 'orderly_shared_resource'') must be unique", - fixed=TRUE) + paste("Every destination filename (in 'arguments to", + "'orderly_shared_resource'') must be unique"), + fixed = TRUE) expect_error( orderly_shared_resource("a", a = "B"), - "Every destination filename (in 'arguments to 'orderly_shared_resource'') must be unique", - fixed=TRUE) + paste("Every destination filename (in 'arguments to", + "'orderly_shared_resource'') must be unique"), + fixed = TRUE) }) + test_that("can't use shared resources if not enabled", { path <- test_prepare_orderly_example("shared") unlink(file.path(path, "shared"), recursive = TRUE)