-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't update suggested dependencies (#1752)
Fixes #1749
- Loading branch information
Showing
4 changed files
with
38 additions
and
20 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 |
---|---|---|
@@ -1,28 +1,41 @@ | ||
test_that("use_tidy_versions() specifies a version for dependencies", { | ||
test_that("sets version for imports & depends dependencies", { | ||
skip_on_cran() | ||
withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) | ||
|
||
pkg <- create_local_package() | ||
create_local_package() | ||
use_package("usethis") | ||
use_package("desc") | ||
use_package("withr", "Suggests") | ||
use_package("gh", "Suggests") | ||
use_package("desc", "Depends") | ||
use_latest_dependencies() | ||
desc <- read_utf8(proj_path("DESCRIPTION")) | ||
desc <- grep("usethis|desc|withr|gh", desc, value = TRUE) | ||
expect_true(all(grepl("\\(>= [0-9.]+\\)", desc))) | ||
|
||
deps <- proj_deps() | ||
expect_equal( | ||
deps$version[deps$package %in% c("usethis", "desc")] == "*", | ||
c(FALSE, FALSE) | ||
) | ||
}) | ||
|
||
test_that("doesn't affect suggests", { | ||
skip_on_cran() | ||
withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) | ||
|
||
create_local_package() | ||
use_package("cli", "Suggests") | ||
use_latest_dependencies() | ||
|
||
deps <- proj_deps() | ||
expect_equal(deps$version[deps$package == "cli"], "*") | ||
}) | ||
|
||
test_that("use_tidy_versions() does nothing for a base package", { | ||
test_that("does nothing for a base package", { | ||
skip_on_cran() | ||
withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) | ||
|
||
## if we ever depend on a recommended package, could beef up this test a bit | ||
pkg <- create_local_package() | ||
create_local_package() | ||
use_package("tools") | ||
use_package("stats", "Suggests") | ||
# if usethis ever depends on a recommended package, we could test that here too | ||
use_latest_dependencies() | ||
desc <- read_utf8(proj_path("DESCRIPTION")) | ||
desc <- grep("tools|stats", desc, value = TRUE) | ||
expect_false(any(grepl("\\(>= [0-9.]+\\)", desc))) | ||
|
||
deps <- proj_deps() | ||
expect_equal(deps$version[deps$package == "tools"], "*") | ||
}) | ||
|