tests/testthat/test-n-words.R

context("n-word")

test_that("n_word pulls the right number of words out",{
  expect_equal(object = n_words(c("one", "two words", "three more words")),
               expected = c(1, 2, 3))
})

test_that("n_word handles '-'",{
  expect_equal(object = n_words(c("one", "two-words", "three-more-words")),
               expected = c(1, 1, 1))
  expect_equal(object = n_words(c("one", "two-words", "three-more words")),
               expected = c(1, 1, 2))
})

Try the syn package in your browser

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

syn documentation built on Dec. 20, 2019, 5:07 p.m.