-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete roxygen for is_treesitter_installed() and a manual test file
- Loading branch information
Showing
4 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# How to test is_treesitter_installed() | ||
# | ||
# `withr` provides a function to temporarily install packages `withr::with_package()` in an | ||
# environment. There is, however, no currently existing way to temporarily uninstalled packages | ||
# to test environments without certain packages. | ||
# | ||
# To test `is_treesitter_installed()`, a manual test has to be executed. | ||
|
||
devtools::load_all() | ||
|
||
remove.packages(c("treesitter", "treesitter.r")) | ||
|
||
testthat::test_that("is_treesitter_installed() returns FALSE when none is installed", { | ||
result <- is_treesitter_installed() | ||
|
||
testthat::expect_false(result) | ||
}) | ||
|
||
testthat::test_that("is_treesitter_installed() returns FALSE when only treesitter is installed", { | ||
install.packages("treesitter") | ||
|
||
result <- is_treesitter_installed() | ||
|
||
testthat::expect_false(result) | ||
remove.packages("treesitter") | ||
}) | ||
|
||
testthat::test_that("is_treesitter_installed() returns FALSE when only treesitter.r is installed", { | ||
install.packages("treesitter.r") | ||
|
||
result <- is_treesitter_installed() | ||
|
||
testthat::expect_false(result) | ||
remove.packages("treesitter.r") | ||
}) | ||
|
||
install.packages(c("treesitter", "treesitter.r")) | ||
|
||
testthat::test_that("is_treesitter_installed() returns TRUE", { | ||
result <- is_treesitter_installed() | ||
|
||
testthat::expect_true(result) | ||
}) | ||
|