Skip to contents

This function processes a list of blocks for the 'longtests' roclet. It calls the 'internal_longtests_roclet_process' function with the specified blocks and additional arguments. The code in the tests is indented, a 'test_that' boilerplate is added to the tests, and a 'context' line is not added to the header.

Usage

# S3 method for class 'roclet_longtests'
roclet_process(x, blocks, env, base_path)

Arguments

x

An object of class 'roclet_longtests'.

blocks

A list of roxygen2 blocks.

env

The environment in which the roxygen2 blocks were parsed.

base_path

A character string representing the base path of the package.

Value

A list with a single element 'longtests', which contains the processed test files.

Examples

# Create a dummy block function
block <- function(roclet, value) {
  list(roclet = roclet, value = value)
}

# Create a new roclet_longtests object
x <- longtests_roclet()

# Define some roxygen2 blocks
blocks <- list(
  block(
    roclet = "longtests",
    value = list(
      raw = "test_that('this is a test', { expect_equal(1, 1) })"
    )
  )
)

blocks <- structure(blocks, class = "roclet_longtests")

# Define the environment and base path
env <- globalenv()
base_path <- tempdir()

# Process the blocks
roxygen2::roclet_process(x, blocks, env, base_path)
#> $longtests
#> list()
#>