Skip to content

Commit

Permalink
use helper for more informative R version message (closes #1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Nov 7, 2024
1 parent e480deb commit 96b8cbb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
skip_if_not_r_version <- function(min_version) {
if (getRversion() < min_version) {
testthat::skip(paste("R version at least", min_version, "is required."))
}
}
2 changes: 1 addition & 1 deletion tests/testthat/test-emmeans.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_on_cran()

# Matrix ABI version may differ (#1204)
skip_if(paste0(R.Version()[c("major", "minor")], collapse = ".") < "4.4.0")
skip_if_not_r_version("4.4.0")

skip_if_not_installed("modeltests")
library(modeltests)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-joineRML.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_on_cran()

# Matrix ABI version may differ (#1204)
skip_if(paste0(R.Version()[c("major", "minor")], collapse = ".") < "4.4.0")
skip_if_not_r_version("4.4.0")

skip_if_not_installed("modeltests")
library(modeltests)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-metafor.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
skip_on_cran()

# Matrix ABI version may differ (#1204)
skip_if(paste0(R.Version()[c("major", "minor")], collapse = ".") < "4.4.0")
skip_if_not_r_version("4.4.0")

skip_if_not_installed("modeltests")
library(modeltests)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-stats-anova.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ test_that("tidy.linearHypothesis", {
})

# Matrix ABI version may differ (#1204)
skip_if(paste0(R.Version()[c("major", "minor")], collapse = ".") < "4.4.0")
skip_if_not_r_version("4.4.0")

skip_if_not_installed("lme4")
test_that("tidy.anova for merMod objects", {
Expand Down

0 comments on commit 96b8cbb

Please sign in to comment.