test_collection: Run a collection of tests

Description Usage Arguments Details

Description

Run transformations on all *-in files in a test directory and compare them with their *-out counterpart.

Usage

1
2
3
4
test_collection(test, sub_test = NULL, write_back = TRUE,
  write_tree = FALSE, transformer, pattern = paste0(if
  (!is.null(sub_test)) paste0("^", sub_test, ".*"),
  "\\-in\\.*(txt|Rmd)*$"), pattern_suffix, ...)

Arguments

test

The test to run. It corresponds to a folder name in tests/testthat.

sub_test

A regex pattern to further reduce the amount of test files to be tested in the test. sub_test must match the beginning of file names in tests/testthat. NULL matches all files.

write_back

Whether the results of the transformation should be written to the output file.

write_tree

Whether or not the tree structure of the test should be computed and written to a file. Note that this needs R >= 3.2 (see set_arg_write_tree(). If the argument is set to NA, the function determines whether R >= 3.2 is in use and if so, trees will be written.

transformer

A function to apply to the content of in_item.

...

Parameters passed to transformer function.

Details

Each file name that matches test and sub_test and ends with "-in" is considered as an input to test. Its counterpart, the reference to compare it against is the *-out file. It is constructed by taking the substring of the *-in.R file before the first dash and adding -out.


lorenzwalthert/stylermd documentation built on May 5, 2019, 1:36 a.m.