1library(pystr) 2context("pystr_strip") 3 4test_that("it strips out whitespace by default", { 5 expect_equal(pystr_strip(" spacious "), "spacious") 6}) 7 8test_that("it leaves spaces in the middle alone", { 9 expect_equal(pystr_strip(" very spacious "), "very spacious") 10}) 11 12test_that("it strips chars from both sides", { 13 expect_equal(pystr_strip("www.example.com", "cmowz."), "example") 14}) 15 16test_that("it returns the same string if there's nothing to strip", { 17 expect_equal(pystr_strip("hello world"), "hello world") 18}) 19 20test_that("it works with a character vector", { 21 expect_equal(pystr_strip(c(" spacious ", " hi ")), c("spacious", "hi")) 22}) 23