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

test_collection(test, sub_test = NULL, write_back = TRUE,
  write_tree = TRUE, transformer, ...)

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.

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.R" is considered as an input to test. Its counterpart, the reference to compare it against is the *-out.R file. It is constructed by taking the substring of the *-in.R file before the first dash and adding -out.R. This allows for multiple in.R files to share one out.R file. You could have one_line-out.R as the reference to compare one_line-random-something-stuff-in.R and one_line-random-but-not-so-much-in.R.

This also implies that -out.R files cannot have more than one dash in their name, i.e. just the one before out.R.