-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bruno Rodrigues
committed
Jul 1, 2024
1 parent
93a7fb9
commit 2b62be4
Showing
5 changed files
with
117 additions
and
73 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
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 |
---|---|---|
|
@@ -56,28 +56,33 @@ testthat::test_that("rix(), ide is 'other' or 'code'", { | |
path_default_nix <- normalizePath(path_default_nix) | ||
|
||
save_default_nix_test <- function(ide, path_default_nix) { | ||
rix( | ||
r_ver = "4.3.1", | ||
r_pkgs = c("data.table", "janitor", "[email protected]", "quarto"), | ||
tex_pkgs = c("amsmath"), | ||
git_pkgs = list( | ||
list( | ||
package_name = "housing", | ||
repo_url = "https://github.com/rap4all/housing/", | ||
branch_name = "fusen", | ||
commit = "1c860959310b80e67c41f7bbdc3e84cef00df18e" | ||
# We need to add this because this function gets called | ||
# twice, so the generated .Rprofile is there already and | ||
# calling the function again raises the warning. | ||
suppressWarnings( | ||
rix( | ||
r_ver = "4.3.1", | ||
r_pkgs = c("data.table", "janitor", "[email protected]", "quarto"), | ||
tex_pkgs = c("amsmath"), | ||
git_pkgs = list( | ||
list( | ||
package_name = "housing", | ||
repo_url = "https://github.com/rap4all/housing/", | ||
branch_name = "fusen", | ||
commit = "1c860959310b80e67c41f7bbdc3e84cef00df18e" | ||
), | ||
list( | ||
package_name = "fusen", | ||
repo_url = "https://github.com/ThinkR-open/fusen", | ||
branch_name = "main", | ||
commit = "d617172447d2947efb20ad6a4463742b8a5d79dc" | ||
) | ||
), | ||
list( | ||
package_name = "fusen", | ||
repo_url = "https://github.com/ThinkR-open/fusen", | ||
branch_name = "main", | ||
commit = "d617172447d2947efb20ad6a4463742b8a5d79dc" | ||
) | ||
), | ||
ide = ide, | ||
project_path = path_default_nix, | ||
overwrite = TRUE, | ||
shell_hook = NULL | ||
ide = ide, | ||
project_path = path_default_nix, | ||
overwrite = TRUE, | ||
shell_hook = NULL | ||
) | ||
) | ||
|
||
file.path(path_default_nix, "default.nix") | ||
|
@@ -114,13 +119,16 @@ testthat::test_that("Quarto gets added to sys packages", { | |
path_default_nix <- normalizePath(tempdir()) | ||
|
||
save_default_nix_test <- function(pkgs, interface, path_default_nix) { | ||
rix( | ||
r_ver = "4.3.1", | ||
r_pkgs = pkgs, | ||
ide = interface, | ||
project_path = path_default_nix, | ||
overwrite = TRUE, | ||
shell_hook = NULL | ||
# Because of rix_init, see above | ||
suppressWarnings( | ||
rix( | ||
r_ver = "4.3.1", | ||
r_pkgs = pkgs, | ||
ide = interface, | ||
project_path = path_default_nix, | ||
overwrite = TRUE, | ||
shell_hook = NULL | ||
) | ||
) | ||
|
||
file.path(path_default_nix, "default.nix") | ||
|
@@ -147,6 +155,10 @@ testthat::test_that("Quarto gets added to sys packages", { | |
), | ||
name = "yes_quarto_default.nix" | ||
) | ||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
|
||
|
@@ -171,13 +183,17 @@ testthat::test_that("r_pkgs = NULL and ide = 'rstudio' work together", { | |
testthat::announce_snapshot_file("rix/null_pkgs_rstudio.nix") | ||
|
||
testthat::expect_snapshot_file( | ||
path = save_default_nix_test( | ||
pkgs = NULL, | ||
interface = "rstudio", | ||
path_default_nix | ||
), | ||
name = "null_pkgs_rstudio.nix" | ||
) | ||
path = save_default_nix_test( | ||
pkgs = NULL, | ||
interface = "rstudio", | ||
path_default_nix | ||
), | ||
name = "null_pkgs_rstudio.nix" | ||
) | ||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
|
||
|
@@ -200,9 +216,13 @@ testthat::test_that("If on darwin and ide = rstudio, raise warning", { | |
} | ||
|
||
testthat::expect_warning( | ||
save_default_nix_test(path_default_nix), | ||
regexp = "refer to the macOS" | ||
) | ||
save_default_nix_test(path_default_nix), | ||
regexp = "refer to the macOS" | ||
) | ||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
testthat::test_that("If R version is 4.4.0, raise warning", { | ||
|
@@ -225,6 +245,10 @@ testthat::test_that("If R version is 4.4.0, raise warning", { | |
save_default_nix_test(path_default_nix), | ||
regexp = "version is not available" | ||
) | ||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
testthat::test_that("If R version is <= 4.1.1, raise warning", { | ||
|
@@ -247,6 +271,11 @@ testthat::test_that("If R version is <= 4.1.1, raise warning", { | |
save_default_nix_test(path_default_nix), | ||
regexp = "older version of R" | ||
) | ||
|
||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
testthat::test_that("If R version is == 3.5.3, raise warning", { | ||
|
@@ -269,6 +298,10 @@ testthat::test_that("If R version is == 3.5.3, raise warning", { | |
save_default_nix_test(path_default_nix), | ||
regexp = "older version of R" | ||
) | ||
|
||
on.exit({ | ||
unlink(path_default_nix, recursive = TRUE, force = TRUE) | ||
}) | ||
}) | ||
|
||
testthat::test_that("rix(), bleeding_edge", { | ||
|
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