tests/testthat/test-reps-functions.R

context("Reps functions")

make_rep_test_function <- function(fnc) {
  function() {
    l1 <- lay_new(
      matrix(1:4, ncol = 2),
      heights = c(1, 3))
    l2 <- fnc(l1, 3)
    lay_show(l2)
  }
}

test_that("rep by col", {
  testthat::skip_on_appveyor()
  testthat::skip_on_cran()
  vdiffr::expect_doppelganger(
    "rep by col",
    make_rep_test_function(customLayout:::layRepByCol)
  )
})

test_that("rep by row", {
  testthat::skip_on_appveyor()
  testthat::skip_on_cran()
  vdiffr::expect_doppelganger(
    "rep by row",
    make_rep_test_function(customLayout:::layRepByRow)
  )
})

test_that("mock layColRepGenerator", {
  customLayout:::layColRepGenerator("widths")
  customLayout:::layColRepGenerator("heights")
})
zzawadz/customLayout documentation built on June 9, 2021, 11:10 a.m.