Skip to content
Prev 5759 / 12125 Next

[R-pkg-devel] Interpret feedback: not write testthat-tests in examples

The point of an example is to provide an illustration of how the function should be used for people who are not software developers. IMO any use of any other functions should be absolutely minimized to reduce the cognitive overload ("you need to understand 13 other concepts before you can understand what this function does"). Even stopifnot is in my view best avoided, and if you choose to use it then the use of that function should come _after_ the use of the function so it can be ignored by the reader without disrupting their reading of the example.

Complex interactions between functions should be described in vignettes, and tests should be stored in test code. R package help already has a reputation for being obtuse to beginners and mixing tests into examples exacerbates that perception.
On July 16, 2020 10:39:45 AM PDT, Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote: