Skip to content

Commit

Permalink
test(beamer): beamer_presentation() incorporates latex dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
atusy committed Jun 15, 2024
1 parent d712e4c commit 56139d1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions tests/testthat/test-beamer_presentation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
test_that("beamer_presentation() incorporates latex dependencies", {
expected_dependencies <- c(
"\\usepackage{longtable}", # from extra_dependencies
"\\usepackage{hyperref}" # from knit_meta
)

extra_dependencies <- list(
# do not include non-latex dependencies
# as pre processor does not care the kind of extra dependencies
latex_dependency("longtable")
)
knit_meta <- list(
latex_dependency("hyperref"),
html_dependency_jquery() # pre_processor should remove html dependencies
)

fmt <- beamer_presentation(extra_dependencies = extra_dependencies)

pandoc_args <- fmt$pre_processor(
list(),
tempfile(),
"static",
knit_meta,
tempdir(),
tempdir()
)

included <- pandoc_args[which(pandoc_args == "--include-in-header") + 1L]
expect_length(included, 1L)
expect_true(file.exists(included))
expect_identical(readLines(included), expected_dependencies)
})
2 changes: 1 addition & 1 deletion tests/testthat/test-pdf_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_that("pdf_document() incorporates latex dependencies", {

extra_dependencies <- list(
# do not include non-latex dependencies
# as latex_dependency() does not care if the kind of dependencies
# as pre processor does not care the kind of extra dependencies
latex_dependency("longtable")
)
knit_meta <- list(
Expand Down

0 comments on commit 56139d1

Please sign in to comment.