Skip to content

Commit 1cb185c

Browse files
committed
Tweaks the helpers
1 parent 182c168 commit 1cb185c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

DESCRIPTION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Imports:
2121
yaml
2222
Suggests:
2323
knitr,
24+
xfun,
25+
withr,
2426
testthat (>= 3.1.0)
2527
VignetteBuilder:
2628
knitr

tests/testthat/helper.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@ local_qmd_file <- function(..., .env = parent.frame()) {
1313
xfun::write_utf8(c(...), path)
1414
path
1515
}
16+
17+
.render <- function(input, ...) {
18+
skip_if_no_quarto()
19+
output_file <- xfun::with_ext(basename(input), "test.out")
20+
quarto_render(input, output_file = output_file, quiet = TRUE, ...)
21+
output_file
22+
}
23+
24+
.render_and_read <- function(input, ...) {
25+
skip_if_not_installed("xfun")
26+
skip_if_not_installed("withr")
27+
out <- .render(input, ...)
28+
withr::local_dir(dirname(input))
29+
xfun::read_utf8(out)
30+
}

0 commit comments

Comments
 (0)