| test_pkg | R Documentation |
The tests are executed in a clean environment with the namespace of the
package to be tested as the parent environment, which means you can use
non-exported objects in the package without having to resort to the triple
colon ::: trick.
test_pkg(package = pkg_name(), dir = c("testit", "tests/testit"), update = NA)
package |
The package name. By default, it is detected from the ‘DESCRIPTION’ file if exists. |
dir |
The directory of the test files; by default, it is the directory ‘testit/’ or ‘tests/testit/’ under the current working directory, whichever exists. You can also specify a custom directory. |
update |
If |
The tests are assumed to be under the ‘testit/’ or ‘tests/testit/’
directory by default (depending on your working directory is the package root
directory or the ‘tests/’ directory). The test scripts must be named of
the form ‘test-*.R’ (or ‘test-*.md’ for snapshot tests); other
files will not be treated as test files (but may also be useful, e.g. you can
source() other scripts in tests).
When a test is executed, the working directory is the same as the directory containing this test, and all existing objects in the test environment will be removed before the code is executed.
See https://pkg.yihui.org/testit/#snapshot-testing for more details about snapshot testing.
NULL. All test files are executed, unless an error occurs.
All test scripts must be encoded in UTF-8 if they contain any multibyte characters.
## Not run:
test_pkg("testit")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.