File: test-f-unwrap.R

package info (click to toggle)
r-cran-lazyeval 0.2.0-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 1,276 kB
  • sloc: ansic: 268; sh: 9; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 474 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
context("f_unwrap")

test_that("f_unwrap substitutes values", {
  n <- 100
  f1 <- f_unwrap(~ x + n)
  f2 <- f_new(quote(x + 100), env = parent.env(environment()))

  expect_identical(f1, f2)
})

test_that("f_unwrap substitutes even in globalenv", {
  .GlobalEnv$`__1` <- 1
  expect_equal(f_rhs(f_unwrap(f_new(quote(`__1`), env = globalenv()))), 1)
})

test_that("doesn't go past empty env", {
  f <- f_new(quote(x == y), env = emptyenv())
  expect_equal(f_unwrap(f), f)
})