Skip to content

Commit

Permalink
Fix tests on Windows R 3.6.x
Browse files Browse the repository at this point in the history
magick does not support R 3.6.x any more, so there
is no asciicast package.
  • Loading branch information
gaborcsardi committed Mar 8, 2024
1 parent 2dffed6 commit 07b84da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ jobs:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
if: runner.os != 'Windows'
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/setup-r-dependencies@v2
if: runner.os == 'Windows'
with:
extra-packages: any::rcmdcheck, asciicast=?ignore-before-r=4.0.0
needs: check


- name: "Set environmental variables"
run: |
cat(paste0("R_USER_CACHE_DIR=", Sys.getenv("GITHUB_WORKSPACE"), "/.github/cache\n"), file = Sys.getenv("GITHUB_ENV"), append = TRUE)
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test_that("is_character", {
})

test_that("is_character errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
fn <- function(x) assert_that(is_character(x)),
fn(1:2),
Expand All @@ -19,6 +20,7 @@ test_that("is_character errors", {
})

test_that("is_character errors, noninteractive", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
interactive = FALSE,
fn <- function(x) assert_that(is_character(x)),
Expand Down Expand Up @@ -57,6 +59,7 @@ test_that("is_string", {
})

test_that("is_string errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_string(x)),
Expand All @@ -76,6 +79,7 @@ test_that("is_optional_string", {
})

test_that("is_optional_string errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_optional_string(x)),
Expand All @@ -93,6 +97,7 @@ test_that("is_flag", {
})

test_that("is_flag errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_flag(x)),
Expand All @@ -110,6 +115,7 @@ test_that("is_path", {
})

test_that("is_path errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_path(x)),
Expand All @@ -128,6 +134,7 @@ test_that("is_optional_path", {
})

test_that("is_optional path errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_optional_path(x)),
Expand All @@ -145,6 +152,7 @@ test_that("all_named", {
})

test_that("all_named errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(all_named(x)),
Expand All @@ -164,6 +172,7 @@ test_that("is_existing_file", {
})

test_that("is_existing_file errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = function(x) transform_no_links(transform_show_cursor(x)),
fn <- function(x) assert_that(is_existing_file(x)),
Expand All @@ -181,6 +190,7 @@ test_that("is_platform_list", {
})

test_that("is_platform_list errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_platform_list(x)),
Expand All @@ -201,6 +211,7 @@ test_that("is_dependencies", {
})

test_that("is_dependencies errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_dependencies(x)),
Expand All @@ -218,6 +229,7 @@ test_that("is_r_version_list", {
})

test_that("is_r_version_list errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = function(x) transform_show_cursor(transform_no_srcref(x)),
fn <- function(x) assert_that(is_r_version_list(x)),
Expand All @@ -233,6 +245,7 @@ test_that("is_difftime", {
})

test_that("is_difftime errors", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = transform_show_cursor,
fn <- function(x) assert_that(is_difftime(x)),
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-assertthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ test_that("assertion returns invalid value", {
})

test_that("default messages", {
if (is_windows() && getRversion() < "4.0.0") skip("No magick")
asciicast::expect_snapshot_r_process(
transform = function(x) {
transform_no_srcref(transform_no_links(transform_show_cursor(x)))
Expand Down

0 comments on commit 07b84da

Please sign in to comment.