| Type: | Package |
| Title: | Various Tests with 'roxygen2' |
| Version: | 0.0.2 |
| Maintainer: | Mikkel Meyer Andersen <mikl@math.aau.dk> |
| Description: | Various tests as 'roxygen2' roclets: e.g. 'testthat' and 'tinytest' tests. Also other static analysis tools as checking parameter documentation consistency and others. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Imports: | roxygen2, methods |
| Depends: | R (≥ 2.10) |
| Suggests: | testthat (≥ 2.1.0), tinytest (≥ 1.1.0), knitr, rmarkdown |
| BugReports: | https://github.com/mikldk/roxytest/issues |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2023-01-11 10:40:33 UTC; mikl |
| Author: | Mikkel Meyer Andersen [aut, cre], Ege Rubak [ctb] |
| Repository: | CRAN |
| Date/Publication: | 2023-01-11 15:50:02 UTC |
Roclet: check presence of @examples in documentation for exported functions
Description
This roclet checks presence of @example/@examples.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise() specifying this roclet.
Usage
examples_roclet()
Value
A roclet to be used e.g. with roxygen2::roxygenise()
See Also
Other roclets:
testthat_roclet,
tinytest_roclet,
param_roclet,
return_roclet,
namespace_roclet,
rd_roclet,
vignette_roclet.
Other roclets:
param_roclet(),
return_roclet(),
testthat_roclet(),
tinytest_roclet()
Examples
x <- "#' Summing two numbers\n#'\n#' @export\nf <- function(x, y) {\n x + y\n}\n"
cat(x)
roxygen2::roc_proc_text(examples_roclet(), x)
Roclet: check consistency of param documentation
Description
This roclet checks consistency between function arguments and the documentation. The idea is to catch such errors earlier than in an R CMD check.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise() specifying this roclet.
Usage
param_roclet()
Value
A roclet to be used e.g. with roxygen2::roxygenise()
See Also
Other roclets:
testthat_roclet,
tinytest_roclet,
examples_roclet,
return_roclet,
namespace_roclet,
rd_roclet,
vignette_roclet.
Other roclets:
examples_roclet(),
return_roclet(),
testthat_roclet(),
tinytest_roclet()
Examples
x <- "#' Summing two numbers\n#'\n#' @export\nf <- function(x, y) {\n x + y\n}\n"
cat(x)
roxygen2::roc_proc_text(param_roclet(), x)
Roclet: check presence of @return in documentation for exported functions
Description
This roclet checks presence of @return that
generates \value in Rd files.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise() specifying this roclet.
Usage
return_roclet()
Value
A roclet to be used e.g. with roxygen2::roxygenise()
See Also
Other roclets:
testthat_roclet,
tinytest_roclet,
param_roclet,
examples_roclet,
namespace_roclet,
rd_roclet,
vignette_roclet.
Other roclets:
examples_roclet(),
param_roclet(),
testthat_roclet(),
tinytest_roclet()
Examples
x <- "#' Summing two numbers\n#'\n#' @export\nf <- function(x, y) {\n x + y\n}\n"
cat(x)
roxygen2::roc_proc_text(return_roclet(), x)
Parse testexamples tag
Description
Parse testexamples tag
Usage
## S3 method for class 'roxy_tag_testexamples'
roxy_tag_parse(x)
Arguments
x |
Input |
Value
Parsed tag
Parse tests tag
Description
Parse tests tag
Usage
## S3 method for class 'roxy_tag_tests'
roxy_tag_parse(x)
Arguments
x |
Input |
Value
Parsed tag
Roclet: make testthat test-files.
Description
This roclet is a workhorse of roxytest, producing the testthat test files specified.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise() specifying this roclet.
Usage
testthat_roclet()
Value
A roclet to be used e.g. with roxygen2::roxygenise()
See Also
Other roclets:
param_roclet,
examples_roclet,
return_roclet,
tinytest_roclet,
namespace_roclet,
rd_roclet,
vignette_roclet.
Other roclets:
examples_roclet(),
param_roclet(),
return_roclet(),
tinytest_roclet()
Examples
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n"
cat(x)
o <- roxygen2::roc_proc_text(testthat_roclet(), x)
cat(o$tests[[1]])
Roclet: make tinytest test-files.
Description
This roclet is a workhorse of roxytest, producing the tinytest test files specified.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise() specifying this roclet.
Usage
tinytest_roclet()
Value
A roclet to be used e.g. with roxygen2::roxygenise()
See Also
Other roclets:
param_roclet,
examples_roclet,
return_roclet,
testthat_roclet,
namespace_roclet,
rd_roclet,
vignette_roclet.
Other roclets:
examples_roclet(),
param_roclet(),
return_roclet(),
testthat_roclet()
Examples
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n"
cat(x)
o <- roxygen2::roc_proc_text(tinytest_roclet(), x)
cat(o$tests[[1]])