tests/testthat/test-to_mixed_case.R

context("to_mixed_case")

test_that("random stuff", {
  expect_equal(to_mixed_case("RStudioRRRStudio"),
               "R_Studio_Rrr_Studio")
  }
)

test_that("preserve-name-attribute",{
  labs <- c(a = "abcDEF", b = "bbccEE", c = "TeESt it")
  
  expect_equal(
    to_mixed_case(labs),
    structure(c("abc_Def", "bbcc_Ee", "Te_E_St_it"), .Names = c("a", 
                                                                "b", "c"))
  )
})

Try the snakecase package in your browser

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

snakecase documentation built on Aug. 28, 2023, 1:07 a.m.