This file is indexed.

/usr/share/doc/r-cran-withr/tests/testthat/test-sink.R is in r-cran-withr 2.1.0-1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
context("With sink")

test_that("with_output_sink works as expected", {
  tmp <- tempfile()
  on.exit(unlink(tmp), add = TRUE)
  tmp2 <- tempfile()
  on.exit(unlink(tmp2), add = TRUE)
  tmp3 <- tempfile()
  on.exit(unlink(tmp3), add = TRUE)

  expect_identical(sink.number(), 0L)

  with_output_sink(tmp, {
    expect_identical(sink.number(), 1L)
    cat("output\n")
  })
  expect_identical(readLines(tmp), "output")

  expect_identical(sink.number(), 0L)

  with_output_sink(tmp, append = TRUE, {
    expect_identical(sink.number(), 1L)
    cat("output 2\n")
  })
  expect_identical(readLines(tmp), c("output", "output 2"))

  expect_identical(sink.number(), 0L)

  expect_warning(
    with_output_sink(tmp, {
      sink()
    }),
    "already removed"
  )

  expect_identical(sink.number(), 0L)

  expect_error(
    with_output_sink(NULL, {
      NULL
    }),
    "cannot be NULL"
  )

  expect_identical(sink.number(), 0L)

})