Skip to content

Commit

Permalink
Style code
Browse files Browse the repository at this point in the history
  • Loading branch information
zenalapp committed Nov 17, 2023
1 parent 3437aaf commit 71478a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/bistro.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bistro <-
seed = 1,
time_limit = 3,
return_lrs = FALSE) {
check_pkg_version('tidyr', utils::packageVersion('tidyr'), '1.3.0')
check_pkg_version("tidyr", utils::packageVersion("tidyr"), "1.3.0")
check_bistro_inputs(
bloodmeal_profiles,
human_profiles,
Expand Down
2 changes: 1 addition & 1 deletion R/identify_matches.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @inheritParams calc_one_log10_lr
#' @keywords internal
identify_one_match_set <- function(log10_lrs, bloodmeal_id) {
check_pkg_version('tidyr', utils::packageVersion('tidyr'), '1.3.0')
check_pkg_version("tidyr", utils::packageVersion("tidyr"), "1.3.0")
bm_id <- bloodmeal_id
log10_lrs <- log10_lrs |>
dplyr::filter(bloodmeal_id == bm_id)
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ ignore_unused_imports <- function() {
#' @param version required package version
#'
#' @return nothing or error if package version too old
check_pkg_version <- function(pkg, curr_version, version){
check_pkg_version <- function(pkg, curr_version, version) {
vers <- utils::compareVersion(as.character(curr_version), version)
if(vers == -1){
if (vers == -1) {
stop("The ", pkg, " package is version ", curr_version, " but must be >= ", version, ". Please update the package to use this function.")
}
}
10 changes: 6 additions & 4 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ test_that("ignore_unused_imports works", {
})

test_that("check_pkg_version works", {
expect_no_error(check_pkg_version('tidyr', '1.1.2', '1.1.1'))
expect_no_error(check_pkg_version('tidyr', '1.1.1', '1.1.1'))
expect_error(check_pkg_version('tidyr', '1.1.1', '1.1.2'),
"The tidyr package is version 1.1.1 but must be >= 1.1.2. Please update the package to use this function.")
expect_no_error(check_pkg_version("tidyr", "1.1.2", "1.1.1"))
expect_no_error(check_pkg_version("tidyr", "1.1.1", "1.1.1"))
expect_error(
check_pkg_version("tidyr", "1.1.1", "1.1.2"),
"The tidyr package is version 1.1.1 but must be >= 1.1.2. Please update the package to use this function."
)
})

0 comments on commit 71478a9

Please sign in to comment.