From d18e849c7f3fe05c5807473ba34dabe18107aadd Mon Sep 17 00:00:00 2001 From: xec-cm Date: Wed, 17 Jan 2024 13:48:30 +0100 Subject: [PATCH] Update biocroxytest.Rmd --- vignettes/biocroxytest.Rmd | 47 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/vignettes/biocroxytest.Rmd b/vignettes/biocroxytest.Rmd index dc992b4..1f58689 100644 --- a/vignettes/biocroxytest.Rmd +++ b/vignettes/biocroxytest.Rmd @@ -53,21 +53,24 @@ robust, reliable, and efficient Bioconductor packages. Once the `r BiocStyle::Githubpkg("xec-cm/biocroxytest")` package is installed, you need to carry out two steps to correctly set up long tests in your package: -**1 - Add the new roclet to your Description file:** You need to add -`biocroxytest::longtests_roclet` to the Roxygen section of your Description file. -This will enable `roxygen2::roxygenize()` to generate long tests from the -`@longtest` tag. Your Description file should have a line similar to this: +**1 - Add the new roclet to your Description file:** + +You need to add `biocroxytest::longtests_roclet` to the Roxygen section of your +Description file. This will enable `roxygen2::roxygenize()` to generate long +tests from the `@longtest` tag. Your Description file should have a line similar +to this: ``` Roxygen: list(roclets = c("namespace", "rd", "biocroxytest::longtests_roclet")) ``` -**2 - Run the `biocroxytest::use_longtests()` function:** This function sets up -the overall infrastructure for long tests. When run, it creates the -`longtests/testthat` directory and the `longtests/testthat.R` file, which are -necessary for storing and running your long tests. Additionally, it generates a -file named `.BBSoptions` that contains the `RunLongTests: TRUE` parameter, -indicating that long tests should be run on the Bioconductor servers. +**2 - Run the `biocroxytest::use_longtests()` function:** + +This function sets up the overall infrastructure for long tests. When run, it +creates the `longtests/testthat` directory and the `longtests/testthat.R` file, +which are necessary for storing and running your long tests. Additionally, it +generates a file named `.BBSoptions` that contains the `RunLongTests: TRUE` +parameter, indicating that long tests should be run on the Bioconductor server. ```{r} # Create the longtests directory and .BBSoptions file @@ -84,10 +87,10 @@ The `r BiocStyle::Githubpkg("xec-cm/biocroxytest")` package allows you to add extensive tests to your functions using the `@longtests` tag in your roxygen comments. Here's a more detailed explanation of how to use it: -**1 - Add the `@longtests` tag to your function documentation**: In your roxygen -comments for each function, you can add a `@longtests` tag followed by the tests -you want to run. These tests should be written as if they were in a -`testthat::test_that()` call. For example: +**1 - Add the `@longtests` tag to your function documentation**: + +In your roxygen comments for each function, you can add a `@longtests` tag +followed by the tests you want to run. These tests should be written as if they were in a `testthat::test_that()` call. For example: ```{r} #' A function to do x @@ -107,15 +110,17 @@ foo <- function(x) { In this example, the function `foo()` has two long tests associated with it: `expect_equal(foo(2), sqrt(2))` and `expect_error(foo("a string"))`. -**2 - Run `roxygen2::roxygenise()`:** After adding the `@longtests` tags to your -functions, you need to run `roxygen2::roxygenise()`. This will generate a new -file in the `longtests/testthat` directory for each R script that contains -functions with `@longtests` tags. The generated files will contain -`testthat::test_that()` calls for each set of long tests. +**2 - Run `roxygen2::roxygenise()`:** + +After adding the `@longtests` tags to your functions, you need to run +`roxygen2::roxygenise()`. This will generate a new file in the `longtests/testthat` +directory for each R script that contains functions with `@longtests` tags. The +generated files will contain `testthat::test_that()` calls for each set of long +tests. For instance, if you have the `foo()` function in a file named `R/functions.R`, -`roxygen2::roxygenise()` will generate a file named -`longtests/test-biocroxytest-tests-functions.R` with the following content: +`roxygen2::roxygenise()` will generate a file named `longtests/test-biocroxytest-tests-functions.R` +with the following content: ```{r results='hide'} # Generated by biocroxytest: do not edit by hand!