Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed Apr 16, 2024
1 parent 6a7a262 commit 083b56e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
9 changes: 5 additions & 4 deletions R/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 10 additions & 6 deletions tests/testthat/test-run.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 083b56e

Please sign in to comment.