Skip to content

Commit

Permalink
Fix and tests for different types of README when `tool = "quarto_webs…
Browse files Browse the repository at this point in the history
…ite"` (#314)

* init

* patrick

* remove some changes

* typo

* remove patrick

* typo

* fix
  • Loading branch information
etiennebacher authored Feb 10, 2025
1 parent 81f772e commit 61b9ab7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions R/import_readme.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@
}
}

if (tool == "quarto_website") {
tar_file <- fs::path_join(c(tar_dir, "index.md"))
} else {
tar_file <- fs::path_join(c(tar_dir, "README.md"))
}
tar_file <- fs::path_join(c(tar_dir, "README.md"))
src_file <- fs::path_join(c(src_dir, "README.md"))
fs::file_copy(src_file, tar_file, overwrite = TRUE)
.check_md_structure(tar_file)
Expand All @@ -74,7 +70,6 @@
enc2utf8("{{< include README.md >}}"),
fs::path_join(c(tar_dir, "index.md"))
)
fs::file_copy(fs::path_join(c(src_dir, "README.md")), tar_dir)
}
}

Expand Down
24 changes: 24 additions & 0 deletions tests/testthat/test-render_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,30 @@ test_that("quarto: no error for basic workflow, no Github URL", {
expect_no_error(render_docs(verbose = .on_ci()))
})

for (tool in c("docute", "docsify", "quarto_website")) {
test_that("no error with different types of README", {
skip_on_cran()
skip_if(.is_windows() && .on_ci(), "Windows on CI")
create_local_package()

# README.md
cat("hello there", file = "README.md")
setup_docs(tool)
expect_no_error(render_docs(verbose = .on_ci()))
fs::dir_delete("docs")

# README.Rmd
cat("hello there", file = "README.Rmd")
expect_no_error(render_docs(verbose = .on_ci()))
fs::dir_delete("docs")
fs::file_delete("README.Rmd")

# README.qmd
cat("hello there", file = "README.qmd")
expect_no_error(render_docs(verbose = .on_ci()))
})
}

test_that("quarto: autolink", {
skip_on_cran()
skip_if(.is_windows() && .on_ci(), "Windows on CI")
Expand Down

0 comments on commit 61b9ab7

Please sign in to comment.