This file is indexed.

/usr/share/doc/r-cran-tibble/tests/testthat/test-options.R is in r-cran-tibble 1.4.1-1ubuntu1.

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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
context("options")

test_that("tibble option takes preference", {
  withr::with_options(
    list(
      tibble.width = 10,
      dplyr.width = 20
    ),
    expect_equal(tibble_opt("width"), 10)
  )
})

test_that("dplyr option is used for compatibility", {
  withr::with_options(
    list(
      tibble.width = NULL,
      dplyr.width = 20
    ),
    expect_equal(tibble_opt("width"), 20)
  )
})

test_that("fallback to default option", {
  withr::with_options(
    list(
      tibble.width = NULL,
      dplyr.width = NULL
    ),
    expect_equal(tibble_opt("width"), op.tibble[["tibble.width"]])
  )
})

test_that("tibble_width returns user-input width,
          then tibble.width option, then width option", {
  test_width <- 42

  expect_equal(tibble_width(test_width), test_width)
  withr::with_options(
    list(tibble.width = test_width),
    expect_equal(tibble_width(NULL), test_width)
  )
  withr::with_options(
    list(width = test_width),
    expect_equal(tibble_width(NULL), test_width)
  )
})

test_that("tibble_width prefers tibble.width / dplyr.width over width", {
  withr::with_options(
    list(tibble.width = 10, width = 20),
    expect_equal(tibble_width(NULL), 10)
  )

  withr::with_options(
    list(dplyr.width = 10, width = 20),
    expect_equal(tibble_width(NULL), 10)
  )
})

test_that("tibble_glimpse_width returns user-input width,
          then tibble.width option, then width option", {
  test_width <- 42

  expect_equal(tibble_glimpse_width(test_width), test_width)
  withr::with_options(
    list(tibble.width = test_width),
    expect_equal(tibble_glimpse_width(NULL), test_width)
  )
  withr::with_options(
    list(width = test_width),
    expect_equal(tibble_glimpse_width(NULL), test_width)
  )
})

test_that("tibble_glimpse_width prefers tibble.width / dplyr.width over width", {
  withr::with_options(
    list(tibble.width = 10, width = 20),
    expect_equal(tibble_glimpse_width(NULL), 10)
  )

  withr::with_options(
    list(dplyr.width = 10, width = 20),
    expect_equal(tibble_glimpse_width(NULL), 10)
  )
})

test_that("tibble_glimpse_width ignores Inf tibble.width", {
  withr::with_options(
    list(tibble.width = Inf, width = 20),
    expect_equal(tibble_glimpse_width(NULL), 20)
  )
})

test_that("print.tbl ignores max.print option", {
  iris2 <- as_tibble(iris)
  expect_output(
    withr::with_options(list(max.print = 3), print(iris2)),
    capture_output(print(iris2)), fixed = TRUE
  )
})