From 46c6f525905ccb0c54669909b7018a99bf14b391 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 25 Nov 2024 13:45:29 -0800 Subject: [PATCH 1/2] Prefer skip_if_not() to skip_if(!) --- tests/testthat/test-c-api.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-c-api.R b/tests/testthat/test-c-api.R index f6ceefad9..ca53e8fbb 100644 --- a/tests/testthat/test-c-api.R +++ b/tests/testthat/test-c-api.R @@ -175,7 +175,7 @@ test_that("client library passes tests", { return("Disabled") # Avoid installing into system library by default - skip_if(!nzchar(Sys.getenv("RLANG_FULL_TESTS"))) + skip_if_not(nzchar(Sys.getenv("RLANG_FULL_TESTS"))) skip_on_cran() skip_on_ci() @@ -1109,7 +1109,7 @@ test_that("can push to dynamic list-of", { }) test_that("internal error is thrown with OOB dyn-lof access", { - skip_if(!compiled_by_gcc()) + skip_if_not(compiled_by_gcc()) lof <- new_dyn_list_of("integer", 3, 2) expect_snapshot({ err(lof_arr_push_back(lof, 0, 42L), "Location 0 does not exist") From 8fba0a9be7063527152e5f721e46d5b0f856cb02 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 25 Nov 2024 13:47:48 -0800 Subject: [PATCH 2/2] Other usages --- tests/testthat/test-cnd-abort.R | 2 +- tests/testthat/test-cnd-entrace.R | 2 +- tests/testthat/test-trace.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-cnd-abort.R b/tests/testthat/test-cnd-abort.R index 5b00dfa58..d69b66130 100644 --- a/tests/testthat/test-cnd-abort.R +++ b/tests/testthat/test-cnd-abort.R @@ -538,7 +538,7 @@ test_that("generic call is picked up in methods", { test_that("errors are fully displayed (parents, calls) in knitted files", { skip_if_not_installed("knitr") skip_if_not_installed("rmarkdown") - skip_if(!rmarkdown::pandoc_available()) + skip_if_not(rmarkdown::pandoc_available()) expect_snapshot({ writeLines(render_md("test-parent-errors.Rmd")) diff --git a/tests/testthat/test-cnd-entrace.R b/tests/testthat/test-cnd-entrace.R index 42314211a..c07e56544 100644 --- a/tests/testthat/test-cnd-entrace.R +++ b/tests/testthat/test-cnd-entrace.R @@ -343,7 +343,7 @@ test_that("can call `global_entrace()` in knitted documents", { ) skip_if_not_installed("knitr") skip_if_not_installed("rmarkdown") - skip_if(!rmarkdown::pandoc_available()) + skip_if_not(rmarkdown::pandoc_available()) entrace_lines <- render_md("test-entrace.Rmd", env = current_env()) diff --git a/tests/testthat/test-trace.R b/tests/testthat/test-trace.R index 19e4e4cae..e542a6fec 100644 --- a/tests/testthat/test-trace.R +++ b/tests/testthat/test-trace.R @@ -452,7 +452,7 @@ test_that("fails when `bottom` is not on the stack", { test_that("caught error does not display backtrace in knitted files", { skip_if_not_installed("knitr") skip_if_not_installed("rmarkdown") - skip_if(!rmarkdown::pandoc_available()) + skip_if_not(rmarkdown::pandoc_available()) local_options( rlang_backtrace_on_error = NULL,