File: test-site.R

package info (click to toggle)
r-cran-bookdown 0.42%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,752 kB
  • sloc: javascript: 11,343; makefile: 21; sh: 20
file content (9 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
test_that("find_book_proj() correction found the root dir", {
  book_dir <- xfun::normalize_path(local_book())
  withr::local_dir(book_dir)
  expect_equal(find_book_proj("."), book_dir)
  expect_equal(find_book_proj("01-Introduction.Rmd"), book_dir)
  gsub("^(site:.*)$", "\\1 # any comment", xfun::read_utf8("index.Rmd"))
  xfun::gsub_file("index.Rmd", pattern = "^(site:.*)$", replacement = "\\1 # any comment")
  expect_equal(find_book_proj("."), book_dir)
})