-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve names, implement simple test
- Loading branch information
Showing
4 changed files
with
30 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# parsePackageDeps ------------------------------------------------------------- | ||
|
||
#' @importFrom remotes standardise_dep | ||
parsePackageDeps <- function(pkg, dependencies = NA) | ||
parsePackageDeps <- function(description, dependencies = NA) | ||
{ | ||
deps <- tolower(remotes::standardise_dep(dependencies)) | ||
parsed <- lapply(pkg[intersect(deps, names(pkg))], remotes_parse_deps) | ||
rbindAll(parsed, nameColumn = "type") | ||
types <- tolower(remotes::standardise_dep(dependencies)) | ||
|
||
description[intersect(names(description), types)] %>% | ||
lapply(remotes_parse_deps) %>% | ||
rbindAll(nameColumn = "type") | ||
} |
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,17 +1,10 @@ | ||
# | ||
# This file was generated by kwb.test::create_test_files(), | ||
# launched by hsonne on 2024-05-02 17:58:25. | ||
# Please modify the dummy functions so that real cases are | ||
# tested. Then, delete this comment. | ||
# | ||
#library(testthat) | ||
|
||
test_that("allDeps() works", { | ||
|
||
f <- kwb.package:::allDeps | ||
|
||
expect_error( | ||
f() | ||
# Argument "name" fehlt (ohne Standardwert) | ||
) | ||
expect_error(f()) | ||
|
||
f("abc") | ||
}) |
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,17 +1,21 @@ | ||
# | ||
# This file was generated by kwb.test::create_test_files(), | ||
# launched by hsonne on 2024-05-02 18:06:13. | ||
# Please modify the dummy functions so that real cases are | ||
# tested. Then, delete this comment. | ||
# | ||
#library(testthat) | ||
|
||
test_that("parsePackageDeps() works", { | ||
|
||
f <- kwb.package:::parsePackageDeps | ||
|
||
expect_error( | ||
f() | ||
# Argument "pkg" fehlt (ohne Standardwert) | ||
expect_error(f()) | ||
|
||
description <- list( | ||
package = "abc", | ||
imports = "a(>= 1.1.1), b(>= 2.1),c(>= 3)" | ||
) | ||
|
||
result <- f(description) | ||
|
||
expect_s3_class(result, "data.frame") | ||
expect_identical(nrow(result), 3L) | ||
expect_identical(names(result), c("name", "compare", "version", "type")) | ||
expect_true(all(result$type == "imports")) | ||
|
||
}) |