atSource
Run Commands in Another File Using Relative File Paths
Description
This lets a test file "source" another file in the same directory
(or a related directory) as the current test file. I.e., relative
paths are relative to the current file's directory, not R's current
working directory.
Usage
atSource(file, what = c("source", "init", "pop", "clear", "cur_dir"), env)
Arguments
file |
The name of the file to run. The name will generally be a relative path,
like "makeData.R" or "setups/makeData.R" and the root of that
relative path will be the directory containing the file that contains
the call to atSource.
|
what |
The user should not use this argument, which should be used only
by the assertionTest function to control and query the state of
test environement.
|
env |
The user should not use this argument, which should be used only
by the assertionTest function to control the state of test environement.
|
Details
This function depends on assertionTest() to manage the stack of files.
It will not would if you evaluate the test file calling atSource
via eval(parse(testFile)) or source(testFile).
Value
Nothing useful. This is used only for its side effect of creating
objects used in several test files.
See Also
Examples
assertionTest(system.file(package="assertionTest", "test-ex", "clean.t"))