Skip to content

Commit 6d01b3c

Browse files
committed
add test
1 parent 90c6446 commit 6d01b3c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/testthat/test-utilities.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,24 @@ test_that("expose/ignore_data() can round-trip a data.frame", {
188188

189189
})
190190

191+
test_that("allow_lambda converts the correct cases", {
192+
193+
f <- allow_lambda(function(x) x + 1)
194+
expect_equal(f(1), 2)
195+
196+
f <- allow_lambda(~ .x + 1)
197+
expect_equal(f(1), 2)
198+
199+
f <- allow_lambda("A")
200+
expect_equal(f, "A")
201+
202+
f <- allow_lambda(expression(A))
203+
expect_equal(f, expression(A))
204+
205+
f <- allow_lambda(bquote("foo"~"bar"))
206+
expect_equal(f, call("~", "foo", "bar"))
207+
})
208+
191209
test_that("summary method gives a nice summary", {
192210
# This test isn't important enough to break anything on CRAN
193211
skip_on_cran()

0 commit comments

Comments
 (0)