tests/testthat/helper-os.R

skip_if_not_on_os <- function(os) {
  os <- match.arg(os, choices = c("windows", "mac", "linux", "solaris"))
  system <- system_os()

  message <- switch(
    os,
    windows = if (system != "windows") "Not on Windows",
    mac = if (system != "darwin") "Not on Mac",
    linux = if (system != "linux") "Not on Linux",
    solaris = if (system != "sunos") "Not on Solaris"
  )

  if (is.null(message)) {
    invisible(TRUE)
  } else {
    skip(message)
  }
}

# `testthat:::system_os()`
system_os <- function() {
  tolower(Sys.info()[["sysname"]])
}

Try the clock package in your browser

Any scripts or data that you put into this service are public.

clock documentation built on May 31, 2023, 9:39 p.m.