tests/testthat/test-proper.R

context("proper")

test_that("Proper words", {
  my.str <- "a"
  expect_equal(proper(my.str), "A")

  my.str <- "wORD"
  expect_equal(proper(my.str), "Word")

  my.str <- "Dummy"
  expect_equal(proper(my.str), "Dummy")

  my.str <- "sUcH"
  expect_equal(proper(my.str), "Such")

  my.str <- "ExPeCTeD"
  expect_equal(proper(my.str), "Expected")
})

test_that("Proper a phrase", {
  my.str <- "OnE oF sUcH iS a proPer function that capitalizes a string."
  expect_equal(proper(my.str), "One Of Such Is A Proper Function That Capitalizes A String.")
})

Try the loose.rock package in your browser

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

loose.rock documentation built on April 30, 2021, 1:06 a.m.