tests/testthat/test-dots_to_dsts.R

test_that("different input arrangements work.", {
  d1 <- dst_norm(0, 1)
  d2 <- d1 + 1
  d3 <- d1 + 2
  ref <- list(d1, d2, d3)
  ld1 <- list(d1)
  expect_equal(ref, dots_to_dsts(ref))
  expect_equal(ref, dots_to_dsts(list(d1), list(d2, d3)))
  expect_equal(ref, dots_to_dsts(NULL, d1, list(d2, d3)))
  expect_equal(ld1, dots_to_dsts(NULL, d1))
  expect_equal(ld1, dots_to_dsts(list(NULL, d1)))
  expect_equal(ld1, dots_to_dsts(list(NULL), list(d1)))
  expect_equal(ld1, dots_to_dsts(NULL, list(d1)))
  expect_equal(ld1, dots_to_dsts(list(NULL), d1))
  expect_equal(ld1, dots_to_dsts(d1))
  expect_equal(ld1, dots_to_dsts(list(d1)))
  expect_equal(ld1, dots_to_dsts(list(d1, NA), na.rm = TRUE))
  expect_equal(list(d1, NA), dots_to_dsts(list(d1, NA)))
  expect_error(dots_to_dsts(list(list(d1))))
  expect_error(dots_to_dsts(list(d1, "character")))
})
vincenzocoia/distplyr documentation built on March 5, 2024, 9:45 p.m.