This file is indexed.

/usr/share/doc/r-cran-crayon/tests/testthat/test-styles.r is in r-cran-crayon 1.3.2-1.

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
48
49
50
context("Defining new styles")

test_that("new styles are local to importing package", {

  skip("This is not implemented, yet.")

  lib_dir <- tempfile()

  on.exit(try(unloadNamespace("foo1"), silent = TRUE), add = TRUE)
  on.exit(try(unloadNamespace("foo2"), silent = TRUE), add = TRUE)
  on.exit(try(unlink(lib_dir, recursive = TRUE), silent = TRUE), add = TRUE)

  make_packages(
    lib_dir = lib_dir,
    imports = "crayon",

    foo1 = {
      f <- function() {
        make_style(pink = "pink")
      }
      g <- function() {
        names(styles())
      }
    },

    foo2 = {
      f <- function() {
        make_style(maroon = "maroon")
      }
      g <- function() {
        names(styles())
      }
    }
  )

  ## Add style in 'foo1', does not effect 'foo2', or attached crayon
  foo1::f()
  expect_true("pink" %in% foo1::g())
  expect_false("pink" %in% foo2::g())
  expect_false("pink" %in% names(styles()))

  ## Attached style change does not affect imports in packages
  on.exit(drop_style("ivory444"), add = TRUE)
  make_style(ivory444 = "ivory")
  expect_true("ivory444" %in% names(styles()))
  expect_false("ivory444" %in% foo1::g())
  expect_false("ivory444" %in% foo2::g())

  ## TODO: what if the package(s) are not attached
})