test_that("find_book_proj() correction found the root dir", {
  book_dir <- xfun::normalize_path(local_book())
  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)

Try the bookdown package in your browser

Any scripts or data that you put into this service are public.

bookdown documentation built on Sept. 5, 2021, 5:19 p.m.