tests/testthat/test-utils.R

test_that("robust_deparse handles !! nicely", {
  x <- robust_deparse(quote(`$`(a, !!b) + `$`(a, b)))
  expect_identical(
    x,
    "`$`(a, !!b) + a$b"
  )
})

test_that("robust_deparse mirrors deparse otherwise", {
  x <- quote({
    b <- c(0, 9, 6.2, 10.1)
    XtXc <- diag(c(0, 1/100, 1/85, 1/90))
    n <- 100+65+90
    s2 <- 110.15
  })

  expect_identical(
    robust_deparse(x),
    paste(deparse(x), collapse = "\n")
  )
})

Try the makepipe package in your browser

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

makepipe documentation built on Dec. 7, 2022, 5:16 p.m.