tests/testthat/test-ls_fun_args.R

context("test-ls_fun_args")

test_that("extract function args", {
  args <- ls_fun_args(quote(library(tidycode)))
  expect_equal(unlist(args), list(quote(tidycode)))

  args <- ls_fun_args(quote(lm(mpg ~ cyl, mtcars)))
  expect_equal(args[[1]], list(quote(mpg ~ cyl), quote(mtcars)))
  expect_equal(args[[2]], list(quote(mpg), quote(cyl)))
})

Try the tidycode package in your browser

Any scripts or data that you put into this service are public.

tidycode documentation built on Dec. 11, 2019, 1:08 a.m.