tests/testthat/test-misc.R

test_that("capitalization works", {
  expect_error(title_case(2), "character")
  expect_error(title_case(NA_character_), "non-missing")

  expect_identical(title_case("taylor swift"), "Taylor Swift")
  expect_identical(title_case("TAYLOR SWIFT"), "Taylor Swift")
  expect_identical(title_case(c("fearless", "red", "1989")),
                   c("Fearless", "Red", "1989"))
  expect_identical(title_case("fearless (taylor's version)"),
                   "Fearless (Taylor's Version)")
  expect_identical(title_case("taylor-swift"), "Taylor-swift")
})

Try the taylor package in your browser

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

taylor documentation built on May 29, 2024, 10 a.m.