Skip to content

Commit

Permalink
Merge branch 'r-lib:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LDSamson committed Apr 9, 2024
2 parents e679de8 + f060cce commit 85eab44
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
12 changes: 7 additions & 5 deletions R/describe.R
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/reporter.R
Original file line number Diff line number Diff line change
@@ -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()]).
#'
Expand Down
2 changes: 1 addition & 1 deletion man/Reporter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions man/describe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/special-files.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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")`).
Expand Down
2 changes: 1 addition & 1 deletion vignettes/test-fixtures.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.
Expand Down

0 comments on commit 85eab44

Please sign in to comment.