diff --git a/dev/flat_sepuku.Rmd b/dev/flat_sepuku.Rmd new file mode 100644 index 0000000..c654a6f --- /dev/null +++ b/dev/flat_sepuku.Rmd @@ -0,0 +1,66 @@ +--- +title: "flat_sepuku.Rmd empty" +output: html_document +editor_options: + chunk_output_type: console +--- + +```{r development, include=FALSE} +library(testthat) +``` + +```{r development-load} +# Load already included functions if relevant +pkgload::load_all(export_all = FALSE) +``` + +# sepuku + +```{r function-sepuku} +#' sepuku Title +#' +#' @return 1 +#' @export +#' +#' @examples +sepuku <- function( + pkg = ".") { + # Check if the package has a dev folder + if (!dir.exists(file.path(pkg, "dev"))) { + stop("No dev/ folder have been found. Are you sure that your package has been initiated with fusen ?") + } +} +``` + +```{r examples-sepuku} +sepuku() +``` + +```{r tests-sepuku} +dummypackage <- tempfile("sepuku") +dir.create(dummypackage) +fill_description(pkg = dummypackage, fields = list(Title = "Dummy Package")) + +test_that("sepuku is a function", { + expect_true(inherits(sepuku, "function")) +}) + +usethis::with_project(dummypackage, { + browser() + # Add licence + usethis::use_mit_license("John Doe") + + #  Check for a dev folder + expect_error( + sepuku(), "No dev/ folder have been found. Are you sure that your package has been initiated with fusen ?" + ) +}) +``` + + +```{r development-inflate, eval=FALSE} +# Run but keep eval=FALSE to avoid infinite loop +# Execute in the console directly +fusen::inflate(flat_file = "dev/flat_sepuku.Rmd", vignette_name = "Go further") +``` +