Skip to content

Commit 325b968

Browse files
clean up
1 parent 641c476 commit 325b968

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

R/prepare.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ref_install <- function(ref = "master",
3030
)
3131
cache_update(ref, path_pkg)
3232
usethis::ui_done("Installed branch {ref} into {libpath[1]}.")
33+
libpath
3334
}
3435
}
3536

R/testing.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ local_package <- function(pkg_name = fs::path_file(tempfile("pkg")),
4343
withr::local_options(
4444
usethis.quiet = TRUE,
4545
touchstone.n_iterations = 2,
46-
.local_envir = envir
46+
.local_envir = envir,
47+
touchstone.hash_source_package = tibble::tibble(
48+
ref = character(), md5_hashes = list(), path_pkg = character()
49+
)
4750
)
4851
usethis::create_package(path, open = FALSE)
4952
withr::local_dir(path, .local_envir = if (setwd) envir else rlang::current_env())

tests/testthat/test-prepare.R

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@ test_that("can install in isolated repos", {
2121

2222
test_that("cache works", {
2323
ref <- "devel"
24-
withr::local_options(list(
25-
"touchstone.hash_source_package" = tibble::tibble(
26-
ref = character(), md5_hashes = list(), path_pkg = character()
27-
)
28-
))
2924
name_tmp_pkg <- "bli44"
3025
path_pkg <- local_package(name_tmp_pkg, r_sample = "x <- 55")
3126

3227
expect_equal(nrow(cache_get()), 0)
3328
expect_false(cache_up_to_date(ref, path_pkg))
3429
cache_update(ref, path_pkg)
3530
expect_equal(nrow(cache_get()), 1)
36-
print(getwd())
3731
writeLines(c("x <- 55"), "R/sample.R")
3832
expect_true(cache_up_to_date(ref, path_pkg))
3933
writeLines(c("22"), "R/sample.R")
@@ -54,9 +48,11 @@ test_that("cache works", {
5448
expect_true(cache_up_to_date(ref, path_pkg))
5549

5650
# new root
57-
path_pkg <- local_package(name_tmp_pkg, r_sample = "c")
51+
cache <- cache_get()
52+
path_pkg2 <- local_package(name_tmp_pkg, r_sample = "c")
53+
options("touchstone.hash_source_package" = cache)
5854
expect_equal(nrow(cache_get()), 2)
59-
expect_false(cache_up_to_date(ref, path_pkg))
60-
cache_update(ref, path_pkg)
61-
expect_true(cache_up_to_date(ref, path_pkg))
55+
expect_false(cache_up_to_date(ref, path_pkg2))
56+
cache_update(ref, path_pkg2)
57+
expect_true(cache_up_to_date(ref, path_pkg2))
6258
})

0 commit comments

Comments
 (0)