From 6d3346919493f674e32a212303ca7e9d24e43924 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Tue, 13 Feb 2024 14:22:20 +0100 Subject: [PATCH 1/3] Don't evaluate `deferred_run()` example (#1920) --- vignettes/test-fixtures.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/test-fixtures.Rmd b/vignettes/test-fixtures.Rmd index 37791585e..2a2bd5c19 100644 --- a/vignettes/test-fixtures.Rmd +++ b/vignettes/test-fixtures.Rmd @@ -133,7 +133,7 @@ neat <- function(x, sig_digits) { Second, it works when called in the global environment. Since the global environment isn't perishable, like a test environment is, you have to call `deferred_run()` explicitly to execute the deferred events. You can also clear them, without running, with `deferred_clear()`. -```{r} +```{r, eval = FALSE} withr::defer(print("hi")) #> Setting deferred event(s) on global environment. #> * Execute (and clear) with `deferred_run()`. From 29c73be0df48b24736864194feb2c030d77f59df Mon Sep 17 00:00:00 2001 From: Johannes Gruber Date: Tue, 13 Feb 2024 14:22:41 +0100 Subject: [PATCH 2/3] fix typo (#1918) --- R/reporter.R | 2 +- man/Reporter.Rd | 2 +- vignettes/special-files.Rmd | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/reporter.R b/R/reporter.R index 87c801519..78cfc55f6 100644 --- a/R/reporter.R +++ b/R/reporter.R @@ -1,7 +1,7 @@ #' Manage test reporting #' #' The job of a reporter is to aggregate the results from files, tests, and -#' expectations and display them in an informative way. Every testtthat function +#' expectations and display them in an informative way. Every testthat function #' that runs multiple tests provides a `reporter` argument which you can #' use to override the default (which is selected by [default_reporter()]). #' diff --git a/man/Reporter.Rd b/man/Reporter.Rd index c2e36a6dc..eeb7a0ab2 100644 --- a/man/Reporter.Rd +++ b/man/Reporter.Rd @@ -5,7 +5,7 @@ \title{Manage test reporting} \description{ The job of a reporter is to aggregate the results from files, tests, and -expectations and display them in an informative way. Every testtthat function +expectations and display them in an informative way. Every testthat function that runs multiple tests provides a \code{reporter} argument which you can use to override the default (which is selected by \code{\link[=default_reporter]{default_reporter()}}). } diff --git a/vignettes/special-files.Rmd b/vignettes/special-files.Rmd index 7e18526a2..162f7e926 100644 --- a/vignettes/special-files.Rmd +++ b/vignettes/special-files.Rmd @@ -33,7 +33,7 @@ In principle, you should be able to be run your test files in any order or even ## Helper files -Helper files live in `tests/testtthat/`, start with `helper`, and end with `.r` or `.R`. +Helper files live in `tests/testthat/`, start with `helper`, and end with `.r` or `.R`. They are sourced by `devtools::load_all()` (so they're available interactively when developing your packages) and by `test_check()` and friends (so that they're available no matter how your tests are executed). Helper files are a useful place for functions that you've extracted from repeated code in your tests, whether that be test fixtures (`vignette("test-fixtures")`), custom expectations (`vignette("custom-expectations")`), or skip helpers (`vignette("skipping")`). From f060ccec365e1343ae926c53c215a423b295d7a8 Mon Sep 17 00:00:00 2001 From: Salim B Date: Tue, 13 Feb 2024 14:41:21 +0100 Subject: [PATCH 3/3] Explain abbreviations and add links (#1914) --- R/describe.R | 12 +++++++----- man/describe.Rd | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/R/describe.R b/R/describe.R index 0ae6587c3..09a5e5e8d 100644 --- a/R/describe.R +++ b/R/describe.R @@ -1,9 +1,12 @@ #' describe: a BDD testing language #' -#' A simple BDD DSL for writing tests. The language is similar to RSpec for -#' Ruby or Mocha for JavaScript. BDD tests read like sentences and it should -#' thus be easier to understand what the specification of a function/component -#' is. +#' A simple [behavior-driven development +#' (BDD)](https://en.wikipedia.org/wiki/Behavior-driven_development) +#' [domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language) +#' for writing tests. The language is similar to [RSpec](https://rspec.info/) +#' for Ruby or [Mocha](https://mochajs.org/) for JavaScript. BDD tests read +#' like sentences and it should thus be easier to understand what the +#' specification of a function/component is. #' #' Tests using the `describe` syntax not only verify the tested code, but #' also document its intended behaviour. Each `describe` block specifies a @@ -12,7 +15,6 @@ #' functions as a test and is evaluated in its own environment. You #' can also have nested `describe` blocks. #' -#' #' This test syntax helps to test the intended behaviour of your code. For #' example: you want to write a new function for your package. Try to describe #' the specification first using `describe`, before your write any code. diff --git a/man/describe.Rd b/man/describe.Rd index 746e3bd91..cd9119e57 100644 --- a/man/describe.Rd +++ b/man/describe.Rd @@ -15,10 +15,12 @@ it(description, code = NULL) \item{code}{test code containing the specs} } \description{ -A simple BDD DSL for writing tests. The language is similar to RSpec for -Ruby or Mocha for JavaScript. BDD tests read like sentences and it should -thus be easier to understand what the specification of a function/component -is. +A simple \href{https://en.wikipedia.org/wiki/Behavior-driven_development}{behavior-driven development (BDD)} +\href{https://en.wikipedia.org/wiki/Domain-specific_language}{domain-specific language} +for writing tests. The language is similar to \href{https://rspec.info/}{RSpec} +for Ruby or \href{https://mochajs.org/}{Mocha} for JavaScript. BDD tests read +like sentences and it should thus be easier to understand what the +specification of a function/component is. } \details{ Tests using the \code{describe} syntax not only verify the tested code, but