tests/testthat/test-my-test.R

test_that("multiplication works", {
  expect_equal(2 * 2, 4)
})


test_that("error message for dataframe with 0 columns", {
  expect_error(firstColumn(data.frame()),
               "Could not select the first column of a dataframe with 0 columns")

  # dataframe with columns but 0 rows
  expect_equal(firstColumn(data.frame(a = 1, b = 1)[0,]),
               data.frame(a = 1)[0,1, drop = F])
})
lefec/lfemisc documentation built on Nov. 4, 2019, 4:19 p.m.