Package 'roxytest'

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

Help Index


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]])