Skip to content

Commit

Permalink
test!(cache): do not care cache dependencies among parent and child d…
Browse files Browse the repository at this point in the history
…ocuments
  • Loading branch information
atusy committed Nov 5, 2024
1 parent a30b587 commit 74d1327
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tests/testit/test-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,44 +110,3 @@ assert('dep_auto() solves dependencies of child documents', {
})
dep_list$restore()
knit_code$restore()

assert('dep_auto() solves dependencies of parent and child documents', {
# dependency is empty now
(dep_list$get() %==% list())

# base rmd text
parent = c(
'```{r, autodep=TRUE, cache=TRUE}',
'x = runif(1)',
'```',
'```{r, child="child.Rmd"}',
'```',
'```{r, autodep=TRUE, cache=TRUE}',
'print(x)',
'```'
)
child = c(
'```{r, autodep=TRUE, cache=TRUE}',
'x = %s',
'```'
)

td = tempfile()
dir.create(td, showWarnings = FALSE, recursive = TRUE)

# with child document
in_dir(td, {
# with cache, the result should reproduce
writeLines(sprintf(child, 'runif(1)'), 'child.Rmd')
knit1 = knit(text = parent, quiet = TRUE)
(knit(text = parent, quiet = TRUE) %==% knit1)

# on updating `x`, the printed result should change
writeLines(sprintf(child, '"a"'), "child.Rmd")
knit2 = knit(text = parent, quiet = TRUE)
print2 = gsub("\n.*", "", gsub(".*\n##", "##", knit2))
(print2 %==% '## [1] "a"')
})
})
dep_list$restore()
knit_code$restore()

0 comments on commit 74d1327

Please sign in to comment.