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")' 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) 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")) +})