1 context("Utility function")
3 test_that("trimFromStart trims string correctly if string starts with trimCharacters", {
5 sample <- "./something/random"
6 trimCharacters <- "./something/"
8 result <- trimFromStart(sample, trimCharacters)
10 expect_that(result, equals("random"))
13 test_that("trimFromStart returns original string if string doesn't starts with trimCharacters", {
15 sample <- "./something/random"
16 trimCharacters <- "./nothing/"
18 result <- trimFromStart(sample, trimCharacters)
20 expect_that(result, equals("./something/random"))
23 test_that("trimFromEnd trims string correctly if string ends with trimCharacters", {
25 sample <- "./something/random"
26 trimCharacters <- "/random"
28 result <- trimFromEnd(sample, trimCharacters)
30 expect_that(result, equals("./something"))
33 test_that("trimFromEnd returns original string if string doesn't end with trimCharacters", {
35 sample <- "./something/random"
36 trimCharacters <- "specific"
38 result <- trimFromStart(sample, trimCharacters)
40 expect_that(result, equals("./something/random"))