Skip to content

Commit

Permalink
Different condition to skip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Oct 10, 2023
1 parent 82d1a5d commit 99205ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions tests/testthat/test-Compiled.R
Original file line number Diff line number Diff line change
@@ -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))

Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-tally_coverage.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 99205ab

Please sign in to comment.