tests/testthat/test_clipString.R

context("clipString")

test_that("clipString", {
  expect_equal(clipString("abcdef", 7), "abcdef")
  expect_equal(clipString("abcdef", 6), "abcdef")
  expect_equal(clipString("abcdef", 5), "ab...")
  expect_error(clipString("abcdef", 2))

  expect_equal(clipString(NA_character_, 5), NA_character_)
  expect_equal(clipString(c("aaaaa", NA, "aa"), 4), c("a...", NA, "aa"))
})

Try the BBmisc package in your browser

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

BBmisc documentation built on Sept. 29, 2022, 5:12 p.m.