This file is indexed.

/usr/share/doc/r-cran-rlang/tests/testthat/helper-conditions.R is in r-cran-rlang 0.2.0-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
expect_condition <- function(expr,
                             class = NULL,
                             regex = NULL,
                             info = NULL,
                             label = NULL) {
  object <- tryCatch(expr, condition = identity)

  if (is_na(class)) {
    expect_false(inherits(object, "condition"), info = info, label = label)
    return(invisible(object))
  }

  expect_is(object, "condition", info = info, label = label)

  if (!is_null(class)) {
    expect_is(object, class, info = info, label = label)
  }
  if (!is_null(regex)) {
    expect_match(object$message, regex, class, info = info, label = label)
  }

  invisible(object)
}

expect_no_error <- function(...) {
  expect_error(regexp = NA, ...)
}
expect_no_error_ <- function(object, ...) {
  expect_error(object, regexp = NA, ...)
}

with_verbose_retirement <- function(expr) {
  with_options(lifecycle_force_verbose_retirement = TRUE, expr)
}
with_non_verbose_retirement <- function(expr) {
  with_options(lifecycle_force_verbose_retirement = NULL, expr)
}

# This is set automatically with newer testthat versions. However it
# is easier to develop rlang with the older testthat for now because
# of the dangling pointers after a load_all().
options(lifecycle_force_verbose_retirement = TRUE)