File: test-utils.R

package info (click to toggle)
r-cran-prettycode 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 408 kB
  • sloc: sh: 13; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

context("utils")

test_that("is_interactive", {
  expect_identical(interactive(), is_interactive())
})

test_that("is_terminal, not a tty", {
  mockery::stub(is_terminal, "isatty", FALSE)
  expect_false(is_terminal())
})

test_that("is_terminal, rstudio", {
  withr::with_envvar(
    c("RSTUDIO" = "1"),
    expect_false(is_terminal())
  )
})

test_that("is_terminal, rgui", {
  withr::with_envvar(
    c("R_GUI_APP_VERSION" = "1.2.3"),
    expect_false(is_terminal())
  )
})

test_that("is_terminal, emacs", {
  withr::with_options(
    list("STERM" = "iESS"),
    expect_false(is_terminal())
  )
})