Skip to content

Commit

Permalink
make a fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Polkas committed Sep 27, 2024
1 parent a08018f commit 51be252
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions R/deps_timemachine.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ pac_deps_timemachine <- function(pac,
# not care about many versions for certain apckage as we taking the newset version
if (isTRUE(r != "R" && r != pac && (!r %in% paks_global))) {
pks <- pac_description(r, at = at, local = FALSE)
paks_global <<- c(stats::setNames(r, pks$Version), paks_global[paks_global != r])
if (recursive) deps(r, at, pks[fields])
if (is.list(pks)) {
paks_global <<- c(stats::setNames(r, pks$Version), paks_global[paks_global != r])
if (recursive) deps(r, at, pks[fields])
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ test_that("pacs::pac_deps_timemachine", {
skip_if_offline()
expect_message(pac_deps_timemachine("WRONG", "0.8.0"), "WRONG package is not on CRAN")
expect_identical(suppressMessages(pac_deps_timemachine("WRONG", "0.8.0")), NA)
expect_true(length(pac_deps_timemachine("memoise", "0.2.1")) == 1)
expect_true(length(pac_deps_timemachine("memoise", at = as.Date("2019-01-01"))) == 1)
expect_length(pac_deps_timemachine("memoise", "0.2.1"), 1)
expect_length(pac_deps_timemachine("memoise", at = as.Date("2019-01-01")), 1)
expect_length(pacs::pac_deps_timemachine("ggplot2", at = as.Date("2020-10-10")), 42)
})

test_that("pacs::pac_deps_timemachine offline", {
Expand Down

0 comments on commit 51be252

Please sign in to comment.