Skip to content

Commit

Permalink
use the tinytex package as the test target since this dependency is m…
Browse files Browse the repository at this point in the history
…ore unlikely to be removed
  • Loading branch information
yihui committed Dec 5, 2023
1 parent d3c54ef commit 6c24307
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/site/PageA.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ knitr::opts_chunk$set(echo = TRUE)
Let's load a package (from existing dependencies) and make sure it's not on the search path when rendering a subsequent file.

```{r}
library(bslib)
library(tinytex)
plot(cars)
```

Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-site.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ test_that("render_site respects 'new_session' in the config", {
a <- readLines(file.path(site_dir, "_site", "PageA.html"))
b <- readLines(file.path(site_dir, "_site", "PageB.html"))

# pkg loaded in PageA (bslib) should show up in search path of PageB
expect_match(a, "library(bslib)", fixed = TRUE, all = FALSE)
expect_true(any(grepl("bslib", b, fixed = TRUE)))
# pkg loaded in PageA (tinytex) should show up in search path of PageB
expect_match(a, "library(tinytex)", fixed = TRUE, all = FALSE)
expect_true(any(grepl("tinytex", b, fixed = TRUE)))

# edit config --> new_session: true
cat("new_session: true", file = file.path(site_dir, "_site.yml"), append = TRUE)
Expand All @@ -77,9 +77,9 @@ test_that("render_site respects 'new_session' in the config", {
a <- readLines(file.path(site_dir, "_site", "PageA.html"))
b <- readLines(file.path(site_dir, "_site", "PageB.html"))

# pkg loaded in PageA (bslib) should NOT show up in search path of PageB
expect_match(a, "library(bslib)", fixed = TRUE, all = FALSE)
expect_false(any(grepl("bslib", b, fixed = TRUE)))
# pkg loaded in PageA (tinytex) should NOT show up in search path of PageB
expect_match(a, "library(tinytex)", fixed = TRUE, all = FALSE)
expect_false(any(grepl("tinytex", b, fixed = TRUE)))
})

test_that("clean_site gives notices before removing", {
Expand Down

0 comments on commit 6c24307

Please sign in to comment.