From 9f0c5507eaab227e5c7889b90e116a4db9bd40d1 Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 25 Mar 2024 08:47:59 +1000 Subject: [PATCH 1/3] use %||% --- R/tar-terra-vect.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/tar-terra-vect.R b/R/tar-terra-vect.R index b3441c7..80502f9 100644 --- a/R/tar-terra-vect.R +++ b/R/tar-terra-vect.R @@ -124,9 +124,7 @@ create_format_terra_vect <- function(filetype, options, ...) { drv <- get_gdal_available_driver_list("vector") - if (is.null(filetype)) { - filetype <- "GeoJSON" - } + filetype <- filetype %||% "GeoJSON" filetype <- match.arg(filetype, drv$name) From 0d72c8aaca5e2b90389403a85d2eaeca894b0d11 Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 25 Mar 2024 08:49:56 +1000 Subject: [PATCH 2/3] add snapshot tests for check_pkg_installed --- tests/testthat/_snaps/check-pkg-installed.md | 8 ++++++++ tests/testthat/test-check-pkg-installed.R | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/testthat/_snaps/check-pkg-installed.md create mode 100644 tests/testthat/test-check-pkg-installed.R diff --git a/tests/testthat/_snaps/check-pkg-installed.md b/tests/testthat/_snaps/check-pkg-installed.md new file mode 100644 index 0000000..c46b38d --- /dev/null +++ b/tests/testthat/_snaps/check-pkg-installed.md @@ -0,0 +1,8 @@ +# check_pkg_installed() works + + Code + check_pkg_installed("asdf") + Condition + Error: + ! package asdf is required + diff --git a/tests/testthat/test-check-pkg-installed.R b/tests/testthat/test-check-pkg-installed.R new file mode 100644 index 0000000..aa94c1b --- /dev/null +++ b/tests/testthat/test-check-pkg-installed.R @@ -0,0 +1,7 @@ +test_that("check_pkg_installed() works", { + expect_snapshot( + error = TRUE, + x = check_pkg_installed("asdf") + ) + expect_null(check_pkg_installed("targets")) +}) From 8b48c448f3d12c506b5d7fa2d70e51ca9dcfa92e Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 25 Mar 2024 09:00:03 +1000 Subject: [PATCH 3/3] use version 2.8.3 of check-r-pkg action? --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 14159b7..fba6bac 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -44,7 +44,7 @@ jobs: extra-packages: any::rcmdcheck needs: check - - uses: r-lib/actions/check-r-package@v2 + - uses: r-lib/actions/check-r-package@v2.8.3 with: upload-snapshots: true build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'