tests/testthat/test-system.R

context("System commands")

test_that("system_check", {

  mockery::stub(system_check, "system2", structure("output", status = 1))
  expect_error(
    system_check("foobar", args = c("arg1", "arg2", quiet = TRUE)),
    "Command foobar failed"
  )

  mockery::stub(system_check, "system2", 42)
  expect_error(
    system_check("foobar", args = c("arg1", "arg2", quiet = FALSE)),
    "Command foobar failed"
  )
})

Try the remotes package in your browser

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

remotes documentation built on July 26, 2023, 5:40 p.m.