| 1 |
|
| 2 |
test_that("history() on an example git repository works", { |
| 3 |
|
| 4 |
skip_on_cran() |
| 5 |
skip_if(!nzchar(Sys.which("git")), "git is not installed") |
| 6 |
|
| 7 |
renv_tests_scope() |
| 8 |
snapshot() |
| 9 |
|
| 10 |
# try initializing a simple git repository |
| 11 |
renv_system_exec("git", c("init", "--quiet"), action = "git init") |
| 12 |
renv_system_exec("git", c("config", "user.name", shQuote("User Name")), action = "git config") |
| 13 |
renv_system_exec("git", c("config", "user.email", shQuote("[email protected]")), action = "git config") |
| 14 |
renv_system_exec("git", c("add", "-A"), action = "git add files") |
| 15 |
renv_system_exec("git", c("commit", "-m", shQuote("initial commit"))) |
| 16 |
|
| 17 |
# retrieve history |
| 18 |
hist <- history() |
| 19 |
|
| 20 |
# check that it worked |
| 21 |
expect_true(nrow(hist) == 1L) |
| 22 |
expect_equal(hist$subject, "initial commit") |
| 23 |
|
| 24 |
}) |
| 25 |
|
| 26 |
|
| 27 |
|