Debian Codegraph @

tests/testthat/test-proxy.R

raw
1 test_that("eval_*() respects proxy settings", {
2 foo <- structure(list(), class = "foo")
3 local_bindings(
4 tidyselect_data_proxy.foo = function(x) {
5 data.frame(x = 1, y = 2)
6 },
7 tidyselect_data_has_predicates.foo = function(x) {
8 FALSE
9 },
10 .env = globalenv()
11 )
12
13 expect_equal(eval_relocate(quote(everything()), foo), c(x = 1, y = 2))
14 expect_equal(eval_select(quote(everything()), foo), c(x = 1, y = 2))
15 expect_equal(eval_rename(quote(c(x = everything())), foo), c(x1 = 1, x2 = 2))
16
17 expect_snapshot(error = TRUE, {
18 eval_select(quote(where(is.numeric)), foo)
19 eval_rename(quote(c(x = where(is.numeric))), foo)
20
21 eval_relocate(quote(where(is.numeric)), foo)
22 eval_relocate(quote(x), before = quote(where(is.numeric)), foo)
23 eval_relocate(quote(x), after = quote(where(is.numeric)), foo)
24 })
25 })