This file is indexed.

/usr/share/doc/r-cran-dplyr/tests/testthat/test-copy_to.R is in r-cran-dplyr 0.7.4-3.

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
context("copy_to")

test_that("src_local only overwrites if overwrite = TRUE", {
  env <- new.env(parent = emptyenv())
  env$x <- 1

  src_env <- src_df(env = env)

  expect_error(
    copy_to(src_env, tibble(x = 1), name = "x"),
    "object with `name` = `x` must not already exist, unless `overwrite` = TRUE",
    fixed = TRUE
  )

  df <- tibble(x = 1)
  copy_to(src_env, df, name = "x", overwrite = TRUE)
  expect_equal(env$x, df)
})

test_that("src_local errs with pkg/env", {
  expect_error(
    src_df("base", new.env()),
    "Exactly one of `pkg` and `env` must be non-NULL, not 2",
    fixed = TRUE
  )

  expect_error(
    src_df(),
    "Exactly one of `pkg` and `env` must be non-NULL, not 0",
    fixed = TRUE
  )
})

test_that("auto_copy() requires same source", {
  skip_if_not_installed("dbplyr")

  env <- new.env(parent = emptyenv())
  env$iris <- iris
  src_iris <- src_df(env = env)

  src_mtcars <- src_sqlite(":memory:", create = TRUE)
  copy_to(src_mtcars, mtcars, "mtcars")

  expect_error(
    auto_copy(tbl(src_iris, "iris"), src_mtcars, name = "iris"),
    "`x` and `y` must share the same src, set `copy` = TRUE (may be slow)",
    fixed = TRUE
  )

  expect_error(
    auto_copy(tbl(src_mtcars, "mtcars"), src_iris, name = "mtcars"),
    "`x` and `y` must share the same src, set `copy` = TRUE (may be slow)",
    fixed = TRUE
  )
})

test_that("src_sqlite() errs if path does not exist", {
  skip_if_not_installed("dbplyr")

  expect_error(
    src_sqlite(":memory:"),
    "`path` must not already exist, unless `create` = TRUE",
    fixed = TRUE
  )
})