File: test-proxy.R

package info (click to toggle)
r-cran-tidyselect 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 616 kB
  • sloc: sh: 13; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (2)
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
test_that("eval_*() respects proxy settings", {
  foo <- structure(list(), class = "foo")
  local_bindings(
    tidyselect_data_proxy.foo = function(x) {
      data.frame(x = 1, y = 2)
    },
    tidyselect_data_has_predicates.foo = function(x) {
      FALSE
    },
    .env = globalenv()
  )

  expect_equal(eval_relocate(quote(everything()), foo), c(x = 1, y = 2))
  expect_equal(eval_select(quote(everything()), foo), c(x = 1, y = 2))
  expect_equal(eval_rename(quote(c(x = everything())), foo), c(x1 = 1, x2 = 2))

  expect_snapshot(error = TRUE, {
    eval_select(quote(where(is.numeric)), foo)
    eval_rename(quote(c(x = where(is.numeric))), foo)

    eval_relocate(quote(where(is.numeric)), foo)
    eval_relocate(quote(x), before = quote(where(is.numeric)), foo)
    eval_relocate(quote(x), after = quote(where(is.numeric)), foo)
  })
})