diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 0df6d157..182fe66f 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -1,3 +1,8 @@ is_r_devel <- function() { startsWith(R.version$status, "Under development") } + +is_win_r41 <- function() { + x <- getRversion() + is_windows() && x$major == 4 && x$minor == 1 +} diff --git a/tests/testthat/test-Compiled.R b/tests/testthat/test-Compiled.R index 221f0ce0..a9c3defc 100644 --- a/tests/testthat/test-Compiled.R +++ b/tests/testthat/test-Compiled.R @@ -1,7 +1,7 @@ context("Compiled") test_that("Compiled code coverage is reported including code in headers", { skip_on_cran() - skip_if(is_windows() && getRversion() == "4.1") + skip_if(is_win_r41()) cov <- as.data.frame(package_coverage("TestCompiled", relative_path = TRUE)) @@ -34,7 +34,7 @@ test_that("Compiled code coverage is reported including code in headers", { test_that("Can pass path to relative_path argument", { skip_on_cran() - skip_if(is_windows() && getRversion() == "4.1") + skip_if(is_win_r41()) cov <- as.data.frame(package_coverage("TestCompiled", relative_path = ".")) expect_true(all(unique(cov$filename) %in% c( @@ -47,7 +47,7 @@ test_that("Can pass path to relative_path argument", { test_that("Source code subdirectories are found", { skip_on_cran() - skip_if(is_windows() && getRversion() == "4.1") + skip_if(is_win_r41()) cov <- as.data.frame(package_coverage("TestCompiledSubdir", relative_path = TRUE)) expect_equal(cov[cov$first_line == "9", "value"], 4) @@ -63,7 +63,7 @@ test_that("Source code subdirectories are found", { test_that("Compiled code coverage is reported under non-standard char's", { skip_on_cran() - skip_if(is_windows() && getRversion() == "4.1") + skip_if(is_win_r41()) cov <- as.data.frame(package_coverage("Test+Char/TestCompiled", relative_path = TRUE)) expect_equal(cov[cov$first_line == "9", "value"], 4) diff --git a/tests/testthat/test-tally_coverage.R b/tests/testthat/test-tally_coverage.R index 7e92a992..93173766 100644 --- a/tests/testthat/test-tally_coverage.R +++ b/tests/testthat/test-tally_coverage.R @@ -1,6 +1,6 @@ test_that("tally_coverage includes compiled code", { skip_on_cran() - skip_if(is_windows() && getRversion() == "4.1") + skip_if(is_win_r41()) cov <- package_coverage(test_path("TestCompiled")) tall <- tally_coverage(cov)