Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* `it()` now finds the correct evaluation environment in more cases (@averissimo, #2085).
* Fixed an issue preventing compilation from succeeding due to deprecation / removal of `std::uncaught_exception()` (@kevinushey, #2047).
* New `skip_unless_r()` to skip running tests on unsuitable versions of R, e.g. `skip_unless_r(">= 4.1.0")` to skip tests that require, say, `...names` (@MichaelChirico, #2022)
* `skip_on_os()` gains an option `"emscripten"` of the `os` argument to skip tests on Emscripten (@eitsupi, #2103).

# testthat 3.2.3

Expand Down
8 changes: 5 additions & 3 deletions R/skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ skip_on_cran <- function() {

#' @export
#' @param os Character vector of one or more operating systems to skip on.
#' Supported values are `"windows"`, `"mac"`, `"linux"`, and `"solaris"`.
#' Supported values are `"windows"`, `"mac"`, `"linux"`, `"solaris"`,
#' and `"emscripten"`.
#' @param arch Character vector of one or more architectures to skip on.
#' Common values include `"i386"` (32 bit), `"x86_64"` (64 bit), and
#' `"aarch64"` (M1 mac). Supplying `arch` makes the test stricter; i.e. both
Expand All @@ -179,15 +180,16 @@ skip_on_cran <- function() {
skip_on_os <- function(os, arch = NULL) {
os <- match.arg(
os,
choices = c("windows", "mac", "linux", "solaris"),
choices = c("windows", "mac", "linux", "solaris", "emscripten"),
several.ok = TRUE
)

msg <- switch(system_os(),
windows = if ("windows" %in% os) "On Windows",
darwin = if ("mac" %in% os) "On Mac",
linux = if ("linux" %in% os) "On Linux",
sunos = if ("solaris" %in% os) "On Solaris"
sunos = if ("solaris" %in% os) "On Solaris",
emscripten = if ("emscripten" %in% os) "On Emscripten"
)

if (!is.null(arch) && !is.null(msg)) {
Expand Down
3 changes: 2 additions & 1 deletion man/skip.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/skip.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
skip_on_os("amiga")
Condition
Error in `match.arg()`:
! 'arg' should be one of "windows", "mac", "linux", "solaris"
! 'arg' should be one of "windows", "mac", "linux", "solaris", "emscripten"

# can skip on multiple oses

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ test_that("can skip on multiple oses", {
expect_snapshot_skip(skip_on_os(c("windows", "linux")))
expect_no_skip(skip_on_os("linux"))
expect_no_skip(skip_on_os("mac"))
expect_no_skip(skip_on_os("emscripten"))
})

test_that("can refine os with arch", {
Expand Down
Loading