tests/testthat/test-pystr_title.R

library(pystr)
context("pystr_title")

test_that("the first letter is capitalized", {
  expect_equal(pystr_title("hello world"), "Hello World")
})

test_that("letters after non-alphas are capitalized", {
  expect_equal(pystr_title("hello3world"), "Hello3World")
})

test_that("it works with a character vector", {
  expect_equal(pystr_title(c("Hello world", "hi mom")), c("Hello World", "Hi Mom"))
})

Try the pystr package in your browser

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

pystr documentation built on April 15, 2017, 12:30 a.m.