Skip to content

Commit

Permalink
test git parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kbvernon committed Nov 15, 2024
1 parent 65065d6 commit cb1c985
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/test-use_crate.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,27 @@ test_that("use_crate(optional = TRUE) adds optional dependency", {

expect_identical(dependency[["optional"]], TRUE)
})

test_that("use_crate(git = <url>) adds dependency with git source", {
skip_if_not_installed("usethis")

path <- local_package("testpkg")

# capture setup messages
withr::local_options(usethis.quiet = FALSE)

use_extendr(path, quiet = TRUE)

use_crate(
"serde",
git = "https://github.com/serde-rs/serde",
path = path
)

metadata <- read_cargo_metadata(path)

dependency <- metadata[["packages"]][["dependencies"]][[1]]
dependency <- dependency[dependency[["name"]] == "serde", ]

expect_equal(dependency[["source"]], "git+https://github.com/serde-rs/serde")
})

0 comments on commit cb1c985

Please sign in to comment.