This suite of functions are for use during testing of sandpaper and are
designed to create/work with a temporary lesson and associated remote
repository (locally) that persists throughout the test suite. These functions
are used in tests/testthat/setup.R
. For more information, see the package scope section of testthat article on Test Fixtures.
Usage
create_test_lesson()
generate_restore_fixture(repo)
setup_local_remote(
repo,
remote = tempfile(),
name = "sandpaper-local",
verbose = FALSE
)
make_branch(repo, branch = NULL, name = "sandpaper-local", verbose = FALSE)
clean_branch(repo, branch = NULL, name = "sandpaper-local", verbose = FALSE)
remove_local_remote(repo, name = "sandpaper-local")
Arguments
- repo
path to a git repository
- remote
path to an empty or uninitialized directory. Defaults to a tempfile
- name
of the remote, defaults to "sandpaper-local"
- verbose
if
TRUE
, messages and output from git will be printed to screen. Defaults toFALSE
.- branch
the name of the new branch to be deleted
Value
(generate_restore_fixture
) a function that will restore the test fixture
(setup_local_remote()
) the repo, invisibly
(remove_local_remote()
) FALSE indicating an error or a string
indicating the path to the remote
Details
create_test_lesson()
This creates the test lesson and calls generate_restore_fixture()
with the
path of the new test lesson.
generate_restore_fixture()
This creates a function that will restore a lesson to its previous commit.