File: test-pause.R

package info (click to toggle)
r-cran-profvis 0.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 868 kB
  • sloc: javascript: 1,943; ansic: 41; sh: 13; makefile: 8
file content (20 lines) | stat: -rw-r--r-- 445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
test_that("pause takes expected time", {
  time <- system.time(pause(0.2))[[3]]
  # system.time is a little inaccurate so allow 10% padding
  expect_lt(abs(time - 0.2) / 0.2, 0.1)
})

test_that("works with integers", {
  expect_no_error(pause(0L))
})

test_that("pause has no srcrefs", {
  expect_equal(attr(pause, "srcref"), NULL)
})

test_that("checks its inputs", {
  expect_snapshot(error = TRUE, {
    pause(c(1, 2))
    pause("a")
  })
})