Title: | Various Tests with 'roxygen2' |
---|---|
Description: | Various tests as 'roxygen2' roclets: e.g. 'testthat' and 'tinytest' tests. Also other static analysis tools as checking parameter documentation consistency and others. |
Authors: | Mikkel Meyer Andersen [aut, cre], Ege Rubak [ctb] |
Maintainer: | Mikkel Meyer Andersen <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0.2 |
Built: | 2024-11-14 05:14:46 UTC |
Source: | https://github.com/mikldk/roxytest |
@examples
in documentation for exported functionsThis roclet checks presence of @example
/@examples
.
Generally you will not call this function directly
but will instead use roxygen2::roxygenise()
specifying this roclet.
examples_roclet()
examples_roclet()
A roclet to be used e.g. with roxygen2::roxygenise()
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()
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)
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)
param
documentationThis 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.
param_roclet()
param_roclet()
A roclet to be used e.g. with roxygen2::roxygenise()
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()
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)
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)
@return
in documentation for exported functionsThis 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.
return_roclet()
return_roclet()
A roclet to be used e.g. with roxygen2::roxygenise()
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()
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)
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
## S3 method for class 'roxy_tag_testexamples' roxy_tag_parse(x)
## S3 method for class 'roxy_tag_testexamples' roxy_tag_parse(x)
x |
Input |
Parsed tag
Parse tests tag
## S3 method for class 'roxy_tag_tests' roxy_tag_parse(x)
## S3 method for class 'roxy_tag_tests' roxy_tag_parse(x)
x |
Input |
Parsed tag
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.
testthat_roclet()
testthat_roclet()
A roclet to be used e.g. with roxygen2::roxygenise()
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()
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n" cat(x) o <- roxygen2::roc_proc_text(testthat_roclet(), x) cat(o$tests[[1]])
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n" cat(x) o <- roxygen2::roc_proc_text(testthat_roclet(), x) cat(o$tests[[1]])
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.
tinytest_roclet()
tinytest_roclet()
A roclet to be used e.g. with roxygen2::roxygenise()
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()
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n" cat(x) o <- roxygen2::roc_proc_text(tinytest_roclet(), x) cat(o$tests[[1]])
x <- "#' @tests\n#' expect_equal(2, 2)\nNULL\n" cat(x) o <- roxygen2::roc_proc_text(tinytest_roclet(), x) cat(o$tests[[1]])